cancel
Showing results for 
Search instead for 
Did you mean: 

Script task execution

seema
Champ in-the-making
Champ in-the-making
Hello everyone

I am executing a script task. I wrote the following code in script :

var scriptVar = 3;
var resultVar=" ";
var resultVarYes="yes";
var resultVarNo="no";
if(scriptVar>0)
{
scriptVar=scriptVar-1;
execution.setVariable("resultVar", resultVarYes)
}
else
{
execution.setVariable("resultVar", resultVarNo)
}


I want to put the value of "resultVarYes" in "resultVar". How to set this value. So i can use value of resultVar.
Any help is appreciated. Thanks in advance.
5 REPLIES 5

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Seema,

have a look on the following test in activiti source please org.activiti.examples.bpmn.scripttask.ScriptTaskTest#testDynamicScript
Regards
Martin

seema
Champ in-the-making
Champ in-the-making
Hii Martin
Thank you for reply… I am able to put the value of "resultVarYes" in "resultVar". But now i want that it also store the value of scriptVar after performing scriptVar=scriptVar-1. How to store the value of scriptVar.

martin_grofcik
Confirmed Champ
Confirmed Champ

seema
Champ in-the-making
Champ in-the-making
Hii Martin

I tried this but it is not storing the value of resultVar after performing resultVar=resultVar-1.

jbarrez
Star Contributor
Star Contributor
I'm not sure I'm following here … but why can't you set it using the setVariable() method?