cancel
Showing results for 
Search instead for 
Did you mean: 

ExclusiveGatewayExpression - Can I use a return of a Spring Bean method call?

edufrazao
Champ on-the-rise
Champ on-the-rise
I want to retrieve some information used in user tasks on a expression in a ExclusiveGateway.

For now, I'm using a ScriptTask to call a local service (A Spring Bean), and set the return as a Process Variable.
<javascript>
var accepted = vFormService.getFormValueAsString(execution.processInstanceId, 'formKey',  'accepted');
execution.setVariable("accepted", accepted);
</javascript>
I use a local form service to handle this data, a custom implementation. I don't use the default FormService from Activiti.

This approach works, but it will be a simplest solution, to call this service from the ExclusiveGateway, like:

<javascript>
#{vFormService.getFormValueAsString(execution.processInstanceId, 'formKey',  'accepted') == 'true'}
</javascript>

I try, but the service is never called, and the default flow is always used.
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
Hmmm, that should work in theory (if the vFormService is a Spring bean). Tried changing to $ instead of # (its a long shot)? Does it work if you just call it from a service task expression

edufrazao
Champ on-the-rise
Champ on-the-rise
Yes, vFormService is a SpringBean. I've named it with a "v" prefix, because formService is also a Bean (Activiti FormService).
Using the same call in a Service Task works, and changing # to $ does not solve the problem. The method is never called.

jbarrez
Star Contributor
Star Contributor
Hmmm  okay, can you post the xml of your process so we can try it ourself?