You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Patrick <pa...@gmail.com> on 2010/03/09 05:28:05 UTC

context does not preserve variable when invoked from GroovyUtil.runScriptAtLocation

Please help, I'm super stuck.

In the file EmailServices.java:
The function sendMailFromScreen has an orderId in bodyParameters.
Context is passed to runScriptAtLocation in GroovyUtil.java.  The
orderId is available here.  :)
The function runScriptAtLocation calls this groovy file, MiniReorderProds.groovy
MiniReorderProds.groovy doesn't have the orderId in the context.  :(

I got the impression that this line preserved the context
InvokerHelper.createScript(scriptClass, getBinding(context)).run();
//in file GroovyUtil.java
But it doesn't seem to.  Thanks in advance.
Patrick

Re: context does not preserve variable when invoked from GroovyUtil.runScriptAtLocation

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Hi Patrick,

Just a blind guess but have you tried getting the orderId from within bodyParameters?
i.e. orderId = bodyParameters.orderId
Sorry if that is exactly what you are doing.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 8/03/2010, at 9:28 PM, Patrick wrote:

> Please help, I'm super stuck.
> 
> In the file EmailServices.java:
> The function sendMailFromScreen has an orderId in bodyParameters.
> Context is passed to runScriptAtLocation in GroovyUtil.java.  The
> orderId is available here.  :)
> The function runScriptAtLocation calls this groovy file, MiniReorderProds.groovy
> MiniReorderProds.groovy doesn't have the orderId in the context.  :(
> 
> I got the impression that this line preserved the context
> InvokerHelper.createScript(scriptClass, getBinding(context)).run();
> //in file GroovyUtil.java
> But it doesn't seem to.  Thanks in advance.
> Patrick