Variable name for custom outcomes?

Showing results for 
Search instead for 
Did you mean: 
Member II

Variable name for custom outcomes?

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="" xmlns:xsi="" xmlns:xsd="" xmlns:activiti="" xmlns:bpmndi="" xmlnsSmiley Surprisedmgdc="" xmlnsSmiley Surprisedmgdi="" typeLanguage="" expressionLanguage="" targetNamespace="">
  <process id="ExampleProcess" name="Example Process" isExecutable="true">
    <startEvent id="startProcess" activiti:formKey="StartForm"></startEvent>
    <userTask id="nextStep" activiti:assignee="$INITIATOR">
        <modeler:activiti-idm-initiator xmlns:modeler=""><![CDATA[true]]></modeler:activiti-idm-initiator>
    <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>
  <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 bpmnElement="nextStep" id="BPMNShape_nextStep">
        <omgdc:Bounds height="80.0" width="100.0" x="175.0" y="138.0"></omgdc:Bounds>
      <bpmndi:BPMNShape bpmnElement="endProcess" id="BPMNShape_endProcess">
        <omgdc:Bounds height="28.0" width="28.0" x="101.0" y="240.0"></omgdc:Bounds>
      <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 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>

But I don't see anything here that would help me know what the name of this variable should be.

1 Reply
Member II

Re: Variable name for custom outcomes?

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.