AnsweredAssumed Answered

ScriptTask, JRuby cannot access execution variable

Question asked by andyb on Jul 6, 2015
Latest reply on Jul 7, 2015 by andyb
Hi, as stated in the subject header, I am trying to write a simple script task in jruby, but am running into a problem wherein the script does not recognize the execution variable's existence in its scope. I'm wondering if any issue like this has been noted before and a solution exists, or whether I'm just doing something stupid.

The test case I'm running is quite simple. I have a form attached to a start activity that requests a username variable. Then in my script I try execution.getVariable('username'), but no luck. I get an error:
      problem evaluation script: org.jruby.embed.EvalFailedException: (NameError) undefined local variable `execution' for main:Object

When I try the same script with groovy I have no problem. My guess then, is that this is a compatibility issue, and indeed looking through the source code, it does appear groovy is given a certain degree of preferential treatment, but I haven't been able to pinpoint in the source just how I would make this work for jruby.

Any explanation would be immensely helpful, as I've spent a long time exhausting a lot of avenues of possibilities for this error, thanks.

Outcomes