process variable vs. condition expression
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 03:13 AM
ich have a question about sequence flows and process variables. I have a process with a script task just after the start event. In the script task i define the process variable outputTransition that can get the value "approved" or "denied". After the script task, an exclusive gateway splits the process. And now i want to discribe the two sequence flows out of the gateway. If the process variable is "approved" it the process should go right if it is "denied" left.
But i get the following error:
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus(outputTransition), workflowContext);06:58:38,253 ERROR [http-bio-8080-exec-3][render_portlet_jsp:154] org.activiti.engine.ActivitiException: Unknown property used in expression at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:55) at org.activiti.engine.impl.el.UelExpressionCondition.evaluate(UelExpressionCondition.java:37) at org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior.leave(ExclusiveGatewayActivityBehavior.java:63) at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.execute(FlowNodeActivityBehavior.java:36) at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44) at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80) at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546) at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:541) at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52) at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80) at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546) at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:541) at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49) at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80) at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546) at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:541) at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:49) at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80) at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546)Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'outputTransition'
Can i use process variables in a flow expression and how? Can i declare a property in a script task so i can use it in a flow expression?
Can someone please help?!
Thanks all 🙂
Best regards, Philipp
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 08:51 AM
<script>
def scriptVar = "test123"
execution.setVariable("myVar", scriptVar)
</script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 09:09 AM
user = Packages.com.liferay.portal.service.UserLocalServiceUtil.fetchUser(10402);
roles = user.getRoleIds();
outputTransition = "denied";
for (i = 0; i < roles.length; i++) {
if (roles[i] == 15) {
outputTransition = "approved";
break;
}
}
Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus(outputTransition), workflowContext);
It works when i just check the variable outputTransition but when i want to use the variable later in the workflow it doesn´t..
Best regards, Philipp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 09:13 AM
execution.setVariable("outputTransition", outputTransition)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 09:26 AM
but it doesn´t help..
Do i have to import another class or something to get it work?
I just create a script task and wrote the code above into main Config of the Script Task.
So when i try like you said, i get the following error:
Caused by: com.liferay.portal.kernel.scripting.ScriptingException: ReferenceError: "execution" is not defined.
I use eclipse and Liferay 6.1.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 10:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 10:27 AM
So Activiti is integrated in liferay.
And i want to use activiti to model different workflows for example to create web content or something.
In my workflows i want add some code in javascript like above. To make it work in Liferay i have to change the scriptformat from javascript to LiferayJavaScript.
But there is one problem that i don´t see yet. For example the execution.setVariable().
So when i use the exmaple above in Liferay with scriptformat "javascript" i get the following error:
[http-bio-8080-exec-3][render_portlet_jsp:154] org.activiti.engine.ActivitiException: problem evaluating script: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "workflowContext" is not defined. (<Unknown source>#17) in <Unknown source> at line number 17
And when i use it with scriptformat "LiferayJavaScript" i get this:
com.liferay.portal.kernel.scripting.ScriptingException: ReferenceError: "execution" is not defined. (script#10)
Greetings and thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2012 03:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2012 03:23 AM
So when i understand you right, execution.setVariable is not supported in Liferay?! Is there any chance to get more information about activiti / Liferay integration?! It is very difficult to get the right information about this topic.
Best Regards, Philipp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2012 03:25 AM
The project not maintained by the Activiti core-team. Perhaps try to contact the project owner?
