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

SOLVED

How to use variable from Javascript code in delivery?

Bowenaus
Level 2
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

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution
Manoj_Kumar_
Correct answer by
Community Advisor
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

 

View solution in original post

1 Reply
Manoj_Kumar_
Correct answer by
Community Advisor
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

 

View solution in original post

Bowenaus
Level 2
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?