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
BedrockMission!

Learn More

View all

Sign in to view all badges

How to keep the value of global variable defined in a wkf after it ends

Avatar

Avatar
Validate 25
Level 4
salvdangelo
Level 4

Likes

45 likes

Total Posts

130 posts

Correct Reply

4 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 4
salvdangelo
Level 4

Likes

45 likes

Total Posts

130 posts

Correct Reply

4 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
salvdangelo
Level 4

18-12-2017

Hi,

May anyone tell me how to keep the value of a global variabile (es. vars.numErrors) defined inside a workflow after the workflow ends its execution?
Note that the status of the workflow is always STARTED because of an external signal.

vars.numErrors is modified inside a javascript activity like that:

if(vars.numErrors == null || vars.numErrors==""){

  vars.numErrors = 0;

}

var numErr = vars.numErrors;

numErr++;

vars.numErrors = numErr;

logInfo("Numero errori: "+numErr);

In current situation, after each execution vars.numErrors will be equal to 1, while I want it to be 1,2,3....

Does it exist a global variable that has a scope greater than the workflow?

Could you suggest me a solution that don't required an SQL table?

Thanks,

Salvatore

Jean-Serge Biron

@nkur

Adhiyan

kirti.rawat

Adobe Campaign

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct Reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct Reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Jean-Serge_Biro
MVP

18-12-2017

Buon giorno Salvatore,

Please use xtk:options for this kind of storage, out of the scope of instance.vars.

You define an entry in Administration>Platfom>Options node.

Then in your workflow, with Javascript activity you set:

setOption ("myValueToKeep", vars.NumErrors)

and getOption for reading the value kept between 2 executions, to initialize the vars.numErrors at the beginning of workflow.

xtk:options lines allow text and numeric values, so it is universal method.
I didn't use xtk:Counters, perhaps it is useful but xtk:options is a global system working fine.

Regards

Jean-Serge

Answers (0)