cancel
Showing results for 
Search instead for 
Did you mean: 

Manning Book Ch5 example - creditCheckOk var not created

jemmerling
Champ in-the-making
Champ in-the-making
So in the Loan Application example, there are 4 variables declared at the start then the first task is a script task that does the following:


      out:println "Checking credit for " + name;
      creditCheckOk = false;
      if((income / 2) > loanAmount){
         creditCheckOk = true;
      }
      out:println "Checked credit for " + name + " outcome is " + creditCheckOk;

Then there is a Java Service task that tries to look at the value of creditCheckOk. When I ran the example, the Java Service Task failed because it couldn't access it. I added creditCheckOk to the form and now it runs successfully, however it also appears as a checkbox in the start form which I don't think is the intended behavior.

It would seem that the introduction of an undeclared variable in a Script Task is supposed to cause it to be created in the process context, however this didn't seem to happen.

As the example is based on a several-years-old version of Activiti, I am wondering if the behavior has changed. If so, what should be done to correct this?

Thanks!
1 REPLY 1

trademak
Star Contributor
Star Contributor
Yes, we've added autoStoreVariables as an attribute that needs to be set to true for variables to be created automatically. It's described in the user guid in the script task section.

Best regards,