Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Looping through additional data inside Delivery activity

somasundaramhal
Level 5
Level 5

Hi,

I have a situation where I want to see all additional data which is added in the query activity inside a delivery/delivery template inside a workflow.

I can get the targetData.fieldname if I already know the fieldname. The scenario is whatever the fields are added in the query as additional data, I want to get those details in a delivery template.

1850846_pastedImage_0.png

Thanks!

5 Replies
Jonathon_wodnicki
Community Advisor
Community Advisor

Hi,

<%= targetData[field] %>. If you don't need the entity escaping you can also stay inside the jssp tag with document.write(targetData[field]).

Thanks,

-Jon

somasundaramhal
Level 5
Level 5

Hi Jon,

My concern is to check how many additional data is added inside the delivery/delivery template. I shouldn't have to manually add <%= targetData[field1] %> <%= targetData[field2] %> <%= targetData[field3] %>.

I want to loop through the targetData. For example, if 3 additional data (targetData.firstName, targetData.lastName, targetData.email) is added, I should be able to code as follows. Because I do not know how many additional data is added in the query activity.

Expected code:

<%

for each(var data in targetData) {

document.write(data + "\n")

}

%>

Expected Output:

First Name

Last Name

Email

Thanks.

Manoj_Kumar_
Community Advisor
Community Advisor

Hello,

You can use a simple forloop for that.

for(var i=0;i <=targetData.length;i++){

document.write(targetData[i] + "\n")

}

Let me know if that make sense?

somasundaramhal
Level 5
Level 5

Hi Manoj,

That doesn't work. Getting error as " targetData is not defined. SCR-160012 JavaScript: error while evaluating script 'content '". If I point like targetData.email that works. The above code that you provided couldn't help me.

Jyoti_Yadav
Community Advisor
Community Advisor

Hi,

You can view Additional Data of your Query activity as explained below:

1851152_pastedImage_0.png

You can add all the parameters you had in your query activity.

Thanks.