instance.vars.foo in Delivery activity | Community
Skip to main content
marcinkacz
New Participant
February 6, 2019
Solved

instance.vars.foo in Delivery activity

  • February 6, 2019
  • 3 replies
  • 5647 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jonathon_wodnicki

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

Jonathon_wodnicki
Jonathon_wodnickiAccepted solution
New Participant
February 14, 2019

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

marcinkacz
New Participant
February 14, 2019

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?

Jonathon_wodnicki
New Participant
February 6, 2019

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