Use instance vars between executions | Community
Skip to main content
Heku_
Level 5
April 13, 2023
Solved

Use instance vars between executions

  • April 13, 2023
  • 3 replies
  • 1807 views

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.
Best answer by ParthaSarathy

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);

 

3 replies

CampaignerForLife
Level 5
April 13, 2023

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 

CampaignerForLife
Level 5
April 13, 2023

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

Level 3
April 13, 2023

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

setOption (adobe.com)

getOption (adobe.com)

ParthaSarathy
Community Advisor
ParthaSarathyCommunity AdvisorAccepted solution
Community Advisor
April 13, 2023

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