Referenced Subflow – Modularize your workflows
SAP Business Technology Platform Workflow Management has workflow capability, enable customers to automate processes. Complex workflow applications require modularization of workflows to enable reuse and better maintenance. Referenced Subflow simplify workflow models and make it more intuitive to both developers and process owners.
SAP Business Technology Platform Workflow management has released Referenced Subflow feature. You can include a workflow as a referenced subflow from another workflow. The parent workflow waits until the referenced subflow has completed the execution.
A workflow can be consumed as referenced subflow from a parent workflow. In the below screen shot a parent workflow (Investment Approval) is using the referenced workflow artifact and using a child workflow (Cost Center Owner Approval). The same workflow is also used in Group Head Approval step.
Add Workflow as Referenced Subflow
In the Referenced Subflow properties, add workflow definition Id of the child / referenced workflow.
Enabling principal propagation will use the credentials of a user while invoking the referenced subflow.
Workflow Context Mapping
A referenced subflow requires context mapping to exchange workflow context as input and output.
Workflow context from the parent workflow is mapped to the child workflow. This is used as the start payload of the child workflow. You can include multiple workflow context elements as input mapping.
Source context path – Parent workflow context path.
Target Context Path – .Workflow context from Referenced Subflow.
In this scenario both parent and child workflow are using the same JSON elements as workflow context. It is possible to have different elements as source and target context path.
Referenced Subflow or Child workflow context is mapped back to the parent workflow as response.
Source context path – Workflow context from Referenced Subflow.
Target Context Path – Parent workflow context path.
In the above screen shot, decision from approver is mapped to parent workflow. Comments are appended to the existing comments in parent workflow context element.
At the end of the Referenced Subflow execution, workflow context is mapped to the parent. The parent workflow context element is overwritten.
While executing a workflow, parent workflow is starting the Subflow or child workflow. Workflow monitoring enable you to navigate between parent and child workflow including the root workflow in multi level referenced subflow use case. The “Show Subflow Instances” action enable navigation from parent workflow instance to all child workflow instances.
All child workflow instances have a link to navigate back to immediate parent workflow instance or the root parent workflow instance.
Workflow Management has added a new feature to execute workflows in parallel by using referenced workflow. Please go through my blog Execute workflow tasks in parallel using SAP Workflow Management | SAP Blogs.
It is possible to define boundary events to a referenced subflow. Please go through my blog Boundary events in Referenced Subflow | SAP Blogs
Refer SAP Workflow Service help for more details.