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

The 4th edition of the Campaign Community Lens newsletter is out now!
SOLVED

instance.vars.foo in Delivery activity

Avatar

Level 4

Hi All,

I have some doubts related to using variables inside delivery activity. I know how to do it using Enrichment and <%= targetData.foo %> in delivery. But I have some questions about other methods:

1) Let's assume that I have declared variable instance.vars.foo="foo" at the beginning of my workflow in JS activity. Why I can simply use <%= instance.vars.foo %> inside Alert activity (in technical workflow) and it works fine, but I can't use it in Delivery activity (in campaign workflow)? Returned error: "JST-#ID# Error while compiling script 'content htmlContent' line 4: instance is not defined. SCR-#ID# JavaScript: error while evaluating script 'content htmlContent'."

2) I have tried set up variable in Delivery/Properties/Variables. I used $(instance/vars/@foo) as an expression. But delivery failed again (error: "Unable to parse expression '$([instance/vars/foo])'. XTK-170018 Parameter of query '[instance/vars/foo]' is not defined in current context."). Any Idea why?

3) How can I assign instance.vars.foo to the variable in Delivery/Properties/Variables? I'm using Recurring delivery, so there is no Initialization Script tab in Properties.

I will appreciate your help.

Thank you,

Marcin

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

- Why I can simply use <%= instance.vars.foo %> inside Alert activity (in technical workflow) and it works fine, but I can't use it in Delivery activity (in campaign workflow)?

Different activities.

- There is no Initialization Script tab in Recurring delivery. How can I assign instance.vars.foo to the variable in Delivery/Properties/Variables?

Assign in a js activity before recurring delivery.

Thanks,

-Jon

3 Replies

Avatar

Community Advisor

Hi,

Add vars to the delivery in the Variables tab of the delivery's Properties dialog.

These are available in the workflow and the delivery as delivery.variables._var[] and variables.varname respectively.

Map one to the other in a js activity or the delivery's init script, e.g. after creating properties var named foobar:

Init script: delivery.variables._var[0] = instance.vars.foo;

Then in delivery: <%= variables.foobar %>

Thanks,

-Jon

Avatar

Level 4

Hi Jon,

Thanks for your input. As I mentioned in my post, I'm aware of this solution. My questions are:

- Why I can simply use <%= instance.vars.foo %> inside Alert activity (in technical workflow) and it works fine, but I can't use it in Delivery activity (in campaign workflow)?

- There is no Initialization Script tab in Recurring delivery. How can I assign instance.vars.foo to the variable in Delivery/Properties/Variables?

Avatar

Correct answer by
Community Advisor

Hi,

- Why I can simply use <%= instance.vars.foo %> inside Alert activity (in technical workflow) and it works fine, but I can't use it in Delivery activity (in campaign workflow)?

Different activities.

- There is no Initialization Script tab in Recurring delivery. How can I assign instance.vars.foo to the variable in Delivery/Properties/Variables?

Assign in a js activity before recurring delivery.

Thanks,

-Jon