Unable to use custom outcomes in process

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2016 03:01 PM
Clarification is needed on how to use Form's custom outcomes with Exclusive Gateway
<!–break–>
I'm trying to create the simple process with UserTask followed by Exclusive Gateway and 2 other UserTasks depended on its condition.
I've created two custom outcomes for the first UserTask: Agree and Disagree.
But I cannot find the right way to set flow conditions for Exclusive Gateway.
${outcome == "Agree"}
doesn't work…Please help,
Regards
- Labels:
-
Archive

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2016 01:07 AM
<blockcode>
org.activiti.engine.ActivitiException: Unknown property used in expression: ${outcome == "Agree"}] with root cause
org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'outcome'
at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:81)
at org.activiti.engine.impl.juel.AstBinary$SimpleOperator.eval(AstBinary.java:27)
at org.activiti.engine.impl.juel.AstBinary.eval(AstBinary.java:192)
at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:49)
at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:25)
</blockcode>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2016 03:25 AM
'outcome' identifier does not exist in the execution.
Could you create jUnit test please?
https://forums.activiti.org/content/sticky-how-write-unit-test
Regards
Martin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2016 09:25 AM
I've created jUnit test but it passes successfully because the 'outcome' needs to be created from Activiti 6 UI reference form and I don't know how to create JUnit test that could produce the same case environment…
I posted full details here: https://activiti.atlassian.net/browse/ACT-4114
BR, Sergey

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2016 01:51 AM
<code>
public boolean checkOutcomeVar(String taskName, String outcome, DelegateExecution delegateExecution) {
Boolean result = false;
ProcessInstance process = runtimeService.createProcessInstanceQuery()
.processInstanceId(delegateExecution.getProcessInstanceId()).singleResult();
Task task = taskService.createTaskQuery().processInstanceId(process.getId()).taskName(taskName).singleResult();
if (task == null) {
throw new FormValidationException("Task '" + taskName + "' was not found");
}
Form form = formProcessingService.getTaskForm(task.getId());
String formNNoutcome = "form" + Long.toString(form.getId()) + "outcome";
String outcomeResult = (String) delegateExecution.getVariable(formNNoutcome);
if (outcomeResult.equals(outcome)) {
result = true;
}
return result;
}
</code>
Now the flow condition is:
<java>${outcomeBean.checkOutcomeVar("UserTask1", "Agree", execution)}</java>
full code is here https://github.com/sarthome/activiti-sa-extensions/blob/master/src/main/java/com/activiti/extension/...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2016 06:24 AM
It is called "from<form_id>outcome" for example ''form1004outcome''.
So you should be able to do something like "${form1004outcome == "Agree"}"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2016 06:29 AM
No, you can't. Because 1004 is process instance dependent number. And you have to identify it dynamically.
So I had to do it via spring bean.
Regards

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2016 11:56 AM
But you are wrong in that the ID is not tied to the instance, it is tied to the deployment.
This means that you do have to dynamically get the id.
I tried to do this in a script, but I cant get access to the FormProcessingService.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2016 09:54 AM
In the task, I create a TaskListener on complete:
Class: org.activiti.engine.impl.bpmn.listener.ScriptTaskListener
Param1 name: language
Param1 string value: javascript
Param2 name: script
Param2 string:
<code>
var formKey = formService.getTaskFormKey(task.getProcessDefinitionId(), task.getTaskDefinitionKey());
var execution = task.getExecution();
var outcome = execution.getVariable('form'+formKey+'outcome');
</code>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2016 03:08 AM
formPrefix+formKey+name
The name should be static from my point of view.
Regards
Martin
