Skip to main content
Heku_
Level 5
Apr 13, 2023 10:56 AM UTC
Solved

Use instance vars between executions

Hi, is there any way to save a variable at the end of a workflow execution and use it in the next execution of the same workflow?

I've tried with instance.vars but it doesn't work.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
ParthaSarathy
ParthaSarathyAccepted solution
Community Advisor
Apr 13, 2023 11:38 AM UTC

Hi @heku_ ,

1) Create an option under /Administration/Platform/Options/ 

2) Workflow:

 

In get option JS, you can call the previously updated instance variable value

getOption('internalNameOfTheOption');

 In setOption JS, you can update the Option value with instance variable.

instance.vars.myVariable = "abcd"; setOption ('internalNameOfTheOption', instance.vars.myVariable);

 

~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups

6 replies

CampaignerForLife
Level 5
Apr 13, 2023 11:09 AM UTC

You could think to do a technical schema with these attributes

 

<attribute name="wkfName" label="Workflow Name" type="string"/>
<attribute name="id" label="Id" type="long"/>

 

Save the vars value there and query when needed 

Translate
CampaignerForLife
Level 5
Apr 13, 2023 11:10 AM UTC

Hope this helped, tell me if you need anything more! 

Translate
Level 3
Apr 13, 2023 11:14 AM UTC

You can also save the variable to an option and then load it in the next run:

setOption (adobe.com)

getOption (adobe.com)

Translate
ParthaSarathy
Community Advisor
ParthaSarathyCommunity AdvisorAccepted solution
Community Advisor
Apr 13, 2023 11:38 AM UTC

Hi @heku_ ,

1) Create an option under /Administration/Platform/Options/ 

2) Workflow:

 

In get option JS, you can call the previously updated instance variable value

getOption('internalNameOfTheOption');

 In setOption JS, you can update the Option value with instance variable.

instance.vars.myVariable = "abcd"; setOption ('internalNameOfTheOption', instance.vars.myVariable);

 

Translate
~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups