Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!
SOLVED

How to use variable from Javascript code in delivery?

Avatar

Level 2

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

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

 


     Manoj
     Find me on LinkedIn

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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

 


     Manoj
     Find me on LinkedIn

Avatar

Level 2
Thanks Manoj. That is helpful and it does essentially answer my question but I think I oversimplified our use case. Is it possible to pass the variable from an API call in aseparate Javascript activity & use that variable later in the workflow inside the delivery activity?