Hi, I've got a workflow with a Sequential Multi Instance call to activiti.
In the called workflow I've got a variable used in gateways (lodgeSubmissions) and I want to use this variable in the Complete condition but it does not seems to work. If I put "lodgeSumbissions.equals("false")" in the complete condition activiti tells that cannot evaluate it, if I get it via execution.getVariable("lodgeSubmissions") it does seem to be present as an execution.
I read the user guide that has an example but does not explain how to obtain the variable in that condition.
What am I doing wrong?
EDIT: from another reading of the user guide it seems that only certain variables can be used there (nrOfCompletedInstances, nrOfActiveInstances, nrOfInstances) but with those I cannot use something that happens in the other subworkflows. Is that correct?
Thank you
for conditions in activiti, you'll have to use expressions (UEL) instead of code snippets. e.g. if lodgeSubmissions is the variable you are trying to monitor on each task inside your multi-instance then the completion condition would be ${!lodgeSubmissions} or ${lodgeSubmissions == false}
The reason why you don't get the variable is because of the variable scope being local to the task inside multi-instance.
Hope it helps.
Hi, Abbas, thanks for the answer.
I'm using the variable inside the gateways in the sub task and it works as expected. But if I use it in the completion condition (eg ${lodgeSubmissions.equals("false")}) of the container I get this error
org.activiti.engine.ActivitiException: Unknown property used in expression: ${lodgeSubmissions.equals("true")} [...] Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'lodgeSubmissions'
So my doubt is that I cannot do what I want to accomplish because the only variables that can be used inside the completion condition of a multi instance are only these three nrOfCompletedInstances, nrOfActiveInstances, nrOfInstances. Is that correct?
Basically all variables (under the process scope) can be used inside completion condition. As i mentioned earlier, you cannot access your variables because of their local scope inside the sub-process. you can use execution listener to set the variable explicitly
(execution.setVariable...)
the listener would run for each instance of the task, and the variable set can then be used inside the completion condition.
Please share example with bpmn and code
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.