AnsweredAssumed Answered

problem evaluating script

Question asked by albertorugnone1 on Oct 22, 2012
Latest reply on Oct 24, 2012 by albertorugnone1
Hello everybody,
this is my second post here.  :mrgreen:
I am pretty newbe in Activiti then I encountered soon some problems that I am not able to solve.
I hope you could help me.

I created an example process named Loan Process. In this, I have a script task with the following code
   
creditCheckOk = false;
if((income / 2) > loanAmount) {
   out:println "credit check is  ok";
   creditCheckOk = true;
}
else
{

   out:println "credit check is not ok";
}
out:println "Checked credit for " + name + " outcome is " + creditCheckOK;

running this process I receive the following exception

org.activiti.engine.ActivitiException: problem evaluating script: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: creditCheckOK for class: Script1

very long stacktrace

Caused by: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: creditCheckOK for class: Script1
   at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:117)
   at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:216)
   at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:75)
   … 86 more
Caused by: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: creditCheckOK for class: Script1
   at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:318)
   at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:111)
   … 88 more
Caused by: groovy.lang.MissingPropertyException: No such property: creditCheckOK for class: Script1
   at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)
   at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
   at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:239)
   at Script1.run(Script1.groovy:13)
   at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:315)
   … 89 more

In my understanding, groovy script should create automatically process variables if def keyword is not used, then also creditCheckOk .
I am quite confused, maybe you could help me.
you can download the project from here
https://www.dropbox.com/s/6q6hifz3rio0mms/LoanRequestFail.zip. The test to be runned is LoanRequestTest.

Thank you very much for your help. :ugeek:

Outcomes