AnsweredAssumed Answered

Following the Groovy script -

Question asked by sathish1 on Apr 23, 2014
Latest reply on Apr 24, 2014 by martin.grofcik
Trying to figure out why this following script is not updating the value of "creditCheckOk" variable, the setup is simple example from the "Activiti in Action"., The first step of the process is to execute this script and then execute the class., with the value that is coming from the script.,


creditCheckOk = false;
customerName = "Mr Sathish"
execution.setVariable("customerName ", "Mr Sathish");
out:println "Checking credit for " + customerName + "income" +  income  + "loanAmount " + loanAmount ;
if((income / 2) > loanAmount) {
creditCheckOk = true;
}
out:println "Checked credit for " + customerName + " outcome is " + creditCheckOk;


when I call this script from the process engine, I can see the console updating the values, but when it comes of this sequence and invokes the CreateApplicationTask class here


public class CreateApplicationTask implements JavaDelegate{
   public void execute(DelegateExecution execution){
      LoanApplication la = new LoanApplication();
      System.out.println("The value of credit check is"+ execution.getVariable("creditCheckOk"));
      System.out.println("The value "+execution.getVariable("loanAmount").getClass());
      la.setCreditCheckOk((Boolean) execution.getVariable("creditCheckOk"));
      la.setCustomerName((String) execution.getVariable("customerName"));
      la.setIncome((Long) execution.getVariable("income"));
      la.setRequestedAmount((Long) execution.getVariable("loanAmount"));
      la.setEmailAddress((String) execution.getVariable("emailAddress"));
      execution.setVariable("loanApplication", la);
   }

}


when it executes to pull the value for

      System.out.println("The value of credit check is"+ execution.getVariable("creditCheckOk")); 


this is returned as null., tght or recommendations from the community.

Outcomes