Subflow or Called Workflow Example

The workflow described in the previous section calls the following workflow using the InitiateSubFlow activity:

<?xml version="1.0"?>
<Workflow Version="0.1">
<Owner>TIBCO</Owner>
<Name>wfin26test1</Name>
<Description lang="en">Test subflow activity</Description>
<Parameter direction="in" eval="variable" type="document" name="inDoc">1</Parameter>
<Parameter direction="in" type="String" eval="variable" name="InStatus">TestInStatus</Parameter>
<Parameter direction="out" eval="variable" type="document" name="OutDoc">workDoc</Parameter>
<Parameter direction="out" eval="variable" type="String" name="status">finalStatus</Parameter>
<Parameter direction="out" eval="variable" type="boolean" name="statusFlag">finalStatusFlag</Parameter>
<Parameter direction="out" eval="constant" type="long" name="statusValue">10</Parameter>
<Parameter direction="out" eval="variable" type="recordList" name="outRecordList1">workRecordList</Parameter>
<Activity Name="AddMsgInfoToEvent">
<Action>UpdateEvent</Action>
<Start/>
<Description lang="en">Initialize Event Info</Description>
<Parameter direction="in" type="string" eval="constant" name="eventState">START</Parameter>
<Parameter direction="in" name="eventDescriptor" type="string" eval="xpath" source="/Message/Body/Document/@subtype">inDoc</Parameter>
<Parameter direction="in" eval="constant" type="String" name="finalStatus">finalStatus1</Parameter>
<Parameter direction="in" eval="constant" type="boolean" name="finalStatusFlag">true</Parameter>
<Parameter direction="in" name="deploymentMode" type="string" eval="xpath" source="/Message/@messageType">inDoc</Parameter>
<Parameter direction="in" name="dbDirectLoadDump" type="string" eval="constant">N</Parameter>
<Parameter direction="in" name="eventType" type="string" eval="constant">CAT</Parameter>
</Activity>
<Activity Name="TestSubflow">
<Action>NoOperation</Action>
<Description>Test Subflow</Description>
<Execution>ASYNCHR</Execution>
<Parameter direction="in" type="string" eval="constant" name="eventState">SPAWNWORKFLOW</Parameter>
<Parameter direction="in" type="document" eval="variable" name="InDocument">inDoc</Parameter>
</Activity>
<Activity Name="ManageRecordCollection">
<Description lang="en">Create Bundles in the Record Collection</Description>
<Action>ManageRecordCollection</Action>
<Parameter direction="in" type="string" eval="constant" name="eventState">CREATEBUNDLE</Parameter>
<Parameter direction="in" name="BundlingOption" type="boolean" eval="constant">false</Parameter>
<Parameter direction="in" name="VersionOption" type="string" eval="constant">LATEST</Parameter>
<Parameter direction="out" name="OutRecordList" type="recordlist" eval="variable">workRecordList</Parameter>
</Activity>
<Transition FromActivity="AddMsgInfoToEvent" ToActivity="TestSubflow"/>
<Transition FromActivity="TestSubflow" ToActivity="ManageRecordCollection"/>
</Workflow>

Input Parameters

This workflow has the following input parameters:

  • InDocument — This parameter is always passed implicitly.
  • InStatus — String. Assigned the value passed by the TestInStatus parameter of the calling workflow.
  • isSubFlow — Boolean. Implicitly passed and set as true when this workflow is called as a subflow. Otherwise, this value is false.
Note: When the subflow executes, it does not receive the eventState parameter even though it is passed by the parent workflow because it is not defined as an IN parameter in the subflow.

Output Parameters

This workflow has following output parameters:

  • outRecordList1 — Record list. Value is assigned by local variable workRecordList which is the output of the ManageRecordCollection activity.
  • statusFlag — Boolean. Value is assigned by local variable finalStatusFlag which is the output of AddMsgInfoEvent activity.
  • status — String. Value is assigned by local variable finalStatus which is the output of the AddMsgInfoEvent activity.
  • statusValue — Long. Assigned a constant value of 10.
    Note: When the subflow completes, the output parameter Testunknown is null as it is not returned by the subflow.