Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards

Use of Javascript variables in delivery

Avatar

Level 4

Hi,

 

I have created one simple workflow in which first activity is JS Code - here, I am trying to store value in instance variable. I have logged this and it is showing under journal. Second acitivity is query in which I am fetching test account and this is working. Third activity is the recurring delivery. I am trying to show instance variable in this delivery. I have added "script" in this delivery and I have also added "variable" under properties.

 

However, emails are not being sent at all.

 

I have followed step as per URL - https://experienceleaguecommunities.adobe.com/t5/adobe-campaign-classic/tuesday-tech-bytes-adobe-cam...

 

@ParthaSarathy - can you please help?

 

JS Code

 

1. instance.vars.temp = functioname('parameters');

2. logInfo(instance.vars.temp);

 

Query

 

1. Temp player ID

 

Delivery

 

HTML:

Data is <%= variables.temp %>

 

Script:

delivery.variables._var[0].stringValue=instance.vars.temp;

 

Variables under properties:

"temp"

 

3 Replies

Avatar

Level 4

Can anyone please help ?

Avatar

Level 1

Hey @vinay16,

 

Your setup looks mostly correct from what you shared.

To help pinpoint the issue, could you please share the exact function (functioname) you’re using in your JS activity? Also, if you can check and share any errors or details from the delivery audit tab, that would be super helpful.

Sometimes the problem comes down to what the function returns—whether it’s a string, object, or function—which affects how you assign it to the delivery variable.

Happy to take a closer look once you share that info!

Thanks,

Avatar

Level 5

Hi! It is not feasible in my experience to write to delivery variables from JS like that. Instead you could create an additional variabel in your query and set the value to the instance.vars.test value. Then you can simply reference <%=targetData.temp%> in the delivery. This is tested and works like a charm 🙂 

So: 


  1. JS activity "instance.vars.test = 'some random text';"
  2. This is the additional data tab of the query element. Set the datafield to the value of the JS defined value like this: 

SorenDP_0-1760517583603.png

3. Rerefence that variable in the delivery with "<%=targetData.temp%>"

Hope that helps!