Expand my Community achievements bar.

SOLVED

Use instance vars between executions

Avatar

Level 7

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Heku_ ,

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

2) Workflow:

ParthaSarathy_0-1681385796625.png

 

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

 

View solution in original post

6 Replies

Avatar

Level 7

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 

Avatar

Level 7

It's a solution similar to use the getOptions and setOptions, but it's not enough efficient.

Avatar

Level 7

You're right, getOption and setOption is the best way to go here! Do you know how to use them?

Avatar

Level 3

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

setOption (adobe.com)

getOption (adobe.com)

Avatar

Correct answer by
Community Advisor

Hi @Heku_ ,

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

2) Workflow:

ParthaSarathy_0-1681385796625.png

 

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