start new workflow inside a workflow

cancel
Showing results for 
Search instead for 
Did you mean: 
skverma02
Active Member II

start new workflow inside a workflow

how can start new workflow inside another workflow?

i am using activiti 5.19.0.

2 Replies
skverma02
Active Member II

Re: start new workflow inside a workflow

sir lets assume a workflow "a.bpmn20.xml" started and in this workflow has  a condition if condition satisfy workflow "b.bpmn20.xml" started  automatically.
 

is this possible or not ?

 

 

 

 

a.bpmn20.xml

 

 

<?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="a" isExecutable="true">
<startEvent id="sid-BB55E8A3-5161-417E-AC09-B8AD28CDE825"></startEvent>
<userTask id="sid-0AAB673C-9AE4-4112-929D-E91F1ECC1CB8" name="taskA" activiti:assignee="kermit">
<extensionElements>
<activiti:formProperty id="decision" name="Enter Decision" type="enum" required="true">
<activiti:value id="accepted" name="accepted"></activiti:value>
<activiti:value id="rejected" name="rejected"></activiti:value>
</activiti:formProperty>
</extensionElements>
</userTask>
<sequenceFlow id="sid-A051F265-7761-47F9-840A-B1F3D0FF9CEA" sourceRef="sid-BB55E8A3-5161-417E-AC09-B8AD28CDE825" targetRef="sid-0AAB673C-9AE4-4112-929D-E91F1ECC1CB8"></sequenceFlow>
<sequenceFlow id="sid-606F3EC0-180D-41AA-A02E-1F0820D41D7A" sourceRef="sid-0AAB673C-9AE4-4112-929D-E91F1ECC1CB8" targetRef="sid-ADAB39E6-FEFE-44BF-AAE3-734263CCE82A"></sequenceFlow>
<userTask id="sid-2F284F13-C8DA-43E3-86B9-AA5521254C1A" name="taskB" activiti:assignee="kermit"></userTask>
<endEvent id="sid-11000A27-437B-4265-8ACD-BEF8DCCAFB68"></endEvent>
<sequenceFlow id="sid-E70B62AB-E77C-40A2-B6D2-A4465B2D5E95" sourceRef="sid-2F284F13-C8DA-43E3-86B9-AA5521254C1A" targetRef="sid-11000A27-437B-4265-8ACD-BEF8DCCAFB68"></sequenceFlow>
<exclusiveGateway id="sid-ADAB39E6-FEFE-44BF-AAE3-734263CCE82A"></exclusiveGateway>
<endEvent id="sid-BA9DDF31-89DB-4B33-B6A3-C0A5BB0473AC"></endEvent>
<sequenceFlow id="sid-5ADD0011-59AF-4817-8E76-EC66D55EFFFF" name="rejected" sourceRef="sid-ADAB39E6-FEFE-44BF-AAE3-734263CCE82A" targetRef="sid-BA9DDF31-89DB-4B33-B6A3-C0A5BB0473AC">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${decision=="rejected"}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="sid-48B8C655-8325-489D-9717-A5925866EDC1" name="accepted" sourceRef="sid-ADAB39E6-FEFE-44BF-AAE3-734263CCE82A" targetRef="sid-2F284F13-C8DA-43E3-86B9-AA5521254C1A">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${decision=="accepted"}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_a">
<bpmndi:BPMNPlane bpmnElement="a" id="BPMNPlane_a">
<bpmndi:BPMNShape bpmnElement="sid-BB55E8A3-5161-417E-AC09-B8AD28CDE825" id="BPMNShape_sid-BB55E8A3-5161-417E-AC09-B8AD28CDE825">
<omgdc:Bounds height="30.0" width="30.0" x="167.25" y="179.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-0AAB673C-9AE4-4112-929D-E91F1ECC1CB8" id="BPMNShape_sid-0AAB673C-9AE4-4112-929D-E91F1ECC1CB8">
<omgdc:Bounds height="80.0" width="100.0" x="285.0" y="154.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-2F284F13-C8DA-43E3-86B9-AA5521254C1A" id="BPMNShape_sid-2F284F13-C8DA-43E3-86B9-AA5521254C1A">
<omgdc:Bounds height="80.0" width="100.0" x="537.25" y="154.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-11000A27-437B-4265-8ACD-BEF8DCCAFB68" id="BPMNShape_sid-11000A27-437B-4265-8ACD-BEF8DCCAFB68">
<omgdc:Bounds height="28.0" width="28.0" x="716.25" y="180.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-ADAB39E6-FEFE-44BF-AAE3-734263CCE82A" id="BPMNShape_sid-ADAB39E6-FEFE-44BF-AAE3-734263CCE82A">
<omgdc:Bounds height="40.0" width="40.0" x="440.25" y="174.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-BA9DDF31-89DB-4B33-B6A3-C0A5BB0473AC" id="BPMNShape_sid-BA9DDF31-89DB-4B33-B6A3-C0A5BB0473AC">
<omgdc:Bounds height="28.0" width="28.0" x="446.25" y="93.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sid-48B8C655-8325-489D-9717-A5925866EDC1" id="BPMNEdge_sid-48B8C655-8325-489D-9717-A5925866EDC1">
<omgdi:waypoint x="479.8253968253968" y="194.42460317460316"></omgdi:waypoint>
<omgdi:waypoint x="537.25" y="194.19762845849803"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-E70B62AB-E77C-40A2-B6D2-A4465B2D5E95" id="BPMNEdge_sid-E70B62AB-E77C-40A2-B6D2-A4465B2D5E95">
<omgdi:waypoint x="637.25" y="194.0"></omgdi:waypoint>
<omgdi:waypoint x="716.25" y="194.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-A051F265-7761-47F9-840A-B1F3D0FF9CEA" id="BPMNEdge_sid-A051F265-7761-47F9-840A-B1F3D0FF9CEA">
<omgdi:waypoint x="197.25" y="194.0"></omgdi:waypoint>
<omgdi:waypoint x="285.0" y="194.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-606F3EC0-180D-41AA-A02E-1F0820D41D7A" id="BPMNEdge_sid-606F3EC0-180D-41AA-A02E-1F0820D41D7A">
<omgdi:waypoint x="385.0" y="194.19880715705767"></omgdi:waypoint>
<omgdi:waypoint x="440.67015968063873" y="194.42015968063873"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-5ADD0011-59AF-4817-8E76-EC66D55EFFFF" id="BPMNEdge_sid-5ADD0011-59AF-4817-8E76-EC66D55EFFFF">
<omgdi:waypoint x="460.63505747126436" y="174.38505747126436"></omgdi:waypoint>
<omgdi:waypoint x="460.32999869390954" y="120.99977143416895"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>

 

 

b.bpmn.20.xml

 

<?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="b" isExecutable="true">
<startEvent id="sid-E22BDAC5-61E5-4BCB-BD63-8F7DC060CC3D"></startEvent>
<userTask id="sid-71ED8469-DBE6-444F-B9EA-F20E1826BF37" name="TaskC" activiti:assignee="kermit"></userTask>
<sequenceFlow id="sid-E48267EC-6D8C-46A4-A981-ADC29DE8809D" sourceRef="sid-E22BDAC5-61E5-4BCB-BD63-8F7DC060CC3D" targetRef="sid-71ED8469-DBE6-444F-B9EA-F20E1826BF37"></sequenceFlow>
<endEvent id="sid-0EF47FAA-2274-4ABD-9D81-7E04E93994C9"></endEvent>
<sequenceFlow id="sid-8B8E8E4F-95D5-41B7-96A5-3A6F89246253" sourceRef="sid-71ED8469-DBE6-444F-B9EA-F20E1826BF37" targetRef="sid-0EF47FAA-2274-4ABD-9D81-7E04E93994C9"></sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_b">
<bpmndi:BPMNPlane bpmnElement="b" id="BPMNPlane_b">
<bpmndi:BPMNShape bpmnElement="sid-E22BDAC5-61E5-4BCB-BD63-8F7DC060CC3D" id="BPMNShape_sid-E22BDAC5-61E5-4BCB-BD63-8F7DC060CC3D">
<omgdc:Bounds height="30.0" width="30.0" x="132.25" y="142.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-71ED8469-DBE6-444F-B9EA-F20E1826BF37" id="BPMNShape_sid-71ED8469-DBE6-444F-B9EA-F20E1826BF37">
<omgdc:Bounds height="80.0" width="100.0" x="207.25" y="117.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-0EF47FAA-2274-4ABD-9D81-7E04E93994C9" id="BPMNShape_sid-0EF47FAA-2274-4ABD-9D81-7E04E93994C9">
<omgdc:Bounds height="28.0" width="28.0" x="352.25" y="143.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sid-E48267EC-6D8C-46A4-A981-ADC29DE8809D" id="BPMNEdge_sid-E48267EC-6D8C-46A4-A981-ADC29DE8809D">
<omgdi:waypoint x="162.25" y="157.0"></omgdi:waypoint>
<omgdi:waypoint x="207.25" y="157.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-8B8E8E4F-95D5-41B7-96A5-3A6F89246253" id="BPMNEdge_sid-8B8E8E4F-95D5-41B7-96A5-3A6F89246253">
<omgdi:waypoint x="307.25" y="157.0"></omgdi:waypoint>
<omgdi:waypoint x="352.25" y="157.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>

daisuke-yoshimo
Senior Member

Re: start new workflow inside a workflow

> sir lets assume a workflow "a.bpmn20.xml" started and in this workflow has  a condition if condition satisfy workflow "b.bpmn20.xml" started  automatically. is this possible or not ?

Yes. It's possible.

You need to use not UserTask but Call Activity to kick another workflow.