I am new to Activiti so please excuse my ignorance. I have installed activiti-app and I am trying to create a simple process with a simple flow condition. I have created a process with a "Start Event" that references a form with nothing but "Possible Outcomes" of "Accept" and "Reject". This event flows to a "User Task" assigned to myself and an "End Event". The flow to the "End Event" is set up as the default flow. I would like to modify the flow condition to the "User Task" to be conditional upon the custom outcomes from the form referenced by the "Start Event". I would expect to be able to use something like "${status == "Accept"}" or "${status == 'Accept'}" or "${status == "Accept"}" or "${outcome == 'Accept'}" but the only thing that seems to keep from generating an error is "${1 == 1}" I suspect that I am not using the right variable name associated with the custom outcomes of the form. I have downloaded and included the xlm for my process here:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef">
<process id="ExampleProcess" name="Example Process" isExecutable="true">
<startEvent id="startProcess" activiti:formKey="StartForm"></startEvent>
<userTask id="nextStep" activiti:assignee="$INITIATOR">
<extensionElements>
<modeler:activiti-idm-initiator xmlns:modeler="http://activiti.com/modeler"><![CDATA[true]]></modeler:activiti-idm-initiator>
</extensionElements>
</userTask>
<endEvent id="endProcess"></endEvent>
<sequenceFlow id="rejectArrow" sourceRef="startProcess" targetRef="endProcess"></sequenceFlow>
<sequenceFlow id="acceptArrow" sourceRef="startProcess" targetRef="nextStep">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${1 == 1}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_ExampleProcess">
<bpmndi:BPMNPlane bpmnElement="ExampleProcess" id="BPMNPlane_ExampleProcess">
<bpmndi:BPMNShape bpmnElement="startProcess" id="BPMNShape_startProcess">
<omgdc:Bounds height="30.0" width="30.0" x="100.0" y="163.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="nextStep" id="BPMNShape_nextStep">
<omgdc:Bounds height="80.0" width="100.0" x="175.0" y="138.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endProcess" id="BPMNShape_endProcess">
<omgdc:Bounds height="28.0" width="28.0" x="101.0" y="240.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="acceptArrow" id="BPMNEdge_acceptArrow">
<omgdi:waypoint x="130.0" y="178.0"></omgdi:waypoint>
<omgdi:waypoint x="175.0" y="178.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="rejectArrow" id="BPMNEdge_rejectArrow">
<omgdi:waypoint x="115.0" y="193.0"></omgdi:waypoint>
<omgdi:waypoint x="115.0" y="240.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
But I don't see anything here that would help me know what the name of this variable should be.
I've figured this out with help from this post. You need to determine the formKey for the referenced form. This is the string you typed into the "Form key" field when you created the form. You can find this by searching the the xlm document for "formKey" or "activiti:formKey". In my case it is "StartForm". The variable name associated with the custom outcome of the form is "form_XXXXXXX_outcome" where XXXXXXX is the formKey. In my case this is "form_StartForm_outcome".
I hope this helps someone else who may have this issue in the future. If there is a better way of doing this I would appreciate knowing. Thanks.
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.