How to use variable from Javascript code in delivery?

Avatar

Avatar

Bowenaus

Avatar

Bowenaus

Bowenaus

28-10-2020

Hello,

Is it possible to include a variable defined in the Javascript code inside of a delivery activity? We wrote some custom Javascript which allows us to loop through a schema of advisors & group them together by wholesaler territory so that we can send an email report to each wholesaler with their specific group of advisors who qualified for a trigger. We can use the JS API to send the deliveries in the Javascript but it is not a very maintainable solution and we would need to loop through that <delivery></delivery> block up to 200 times (once for each wholesaler that has some advisors in the schema). 
2020-10-28_13-23-46.png

Assuming leveraging the delivery activity is the preferred route vs. using a full-on Javascript approach but Adobe Support could not let us know one way or another how to utilize variables inside of a delivery activity. Any guidance is appreciated.

 

 

Thank you!

Austin Bowen

 

 

delivery javascript

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

_Manoj_Kumar

MVP

Avatar

_Manoj_Kumar

MVP

_Manoj_Kumar
MVP

29-10-2020

Hello @Bowenaus ,

 

Go to your delivery > > properties  >  variables tab create a new variable and give it a name for eg. variable ABC, data type of this variable should be string.

 

Then in the advanced tab of the delivery use this code.

delivery.variables._var[0].stringValue =  vars.hello;

 

Then in the delivery template you can print the value of variable ABC like this

<%= variables.ABC %>

 

Thanks,

Manoj

 

Answers (0)