cancel
Showing results for 
Search instead for 
Did you mean: 

Variable name for custom outcomes?

phillip_toone
Champ in-the-making
Champ in-the-making

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" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="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.

1 REPLY 1

phillip_toone
Champ in-the-making
Champ in-the-making

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.