Highlighted

Looping through additional data inside Delivery activity

Avatar

Avatar

somasundaramhal

Avatar

somasundaramhal

somasundaramhal

04-11-2019

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!

Replies

Highlighted

Avatar

Avatar

wodnicki

MVP

Avatar

wodnicki

MVP

wodnicki
MVP

05-11-2019

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

Highlighted

Avatar

Avatar

Jyoti_Y

MVP

Avatar

Jyoti_Y

MVP

Jyoti_Y
MVP

05-11-2019

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.

Highlighted

Avatar

Avatar

somasundaramhal

Avatar

somasundaramhal

somasundaramhal

05-11-2019

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.

Highlighted

Avatar

Avatar

_Manoj_Kumar

MVP

Avatar

_Manoj_Kumar

MVP

_Manoj_Kumar
MVP

11-11-2019

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?

Highlighted

Avatar

Avatar

somasundaramhal

Avatar

somasundaramhal

somasundaramhal

11-11-2019

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.