Skip to Content
Technical Articles

Referenced Subflow – Modularize your workflows

Overview

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.

Referenced Subflow

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.

Input Mapping

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.

Output Mapping

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.

Monitor Workflows

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.

Interested to do a hands on using Referenced Subflow and other interesting Workflow Management features. Please join SAP TechEd 2020 – DEV 264 Deep dive into SAP Cloud Platform Workflow Management.

Refer SAP  Workflow Service help for more details.

11 Comments
You must be Logged on to comment or reply to a post.
  • Hi Balko,

    As of now the parent and referenced subflow are displayed as two instances. But we are planning to enhance Monitor Workflow app in Q1. You can search using  business key and see all instances together.

  • Hey @Venugopal Chembrakalathil

    Could you please help me on how to place these two workflows? Do all the parent and child workflows need to be in the same folder?

     

    • Hi Kajal,

      The workflows need not be in the same folder or same project. The parent is referring the workflow definition ID. Please make sure you have deployed the parent and the child workflows.

       

  • Hi Venugopal Chembrakalathil,

    I have created a workflow in another workspace and I want to use it in my parent workflow.But when I deploy it it's showing referenced subflow definition ID not found.

      • Thank you for your response sir.l did wrong while mapping. I have another doubt too ,when we do data mapping what if we are passing more data in parent than child ,what will we give in target context path.

        Thank you

  • Thank you for the wonderful blog.

    I have a query regarding the sub-flows.

    I have a parent workflow in which I have called another workflow (child).

    The definitions of both the workflows are present in the Monitor Workflows > Workflow Definitions and I am able to run the child workflow independently too.

    But, during the execution of my parent workflow I am getting an error saying that the 'Referenced subflow definition with ID <> not found'. I have re-checked the definition Id multiple times and its correctly mentioned in the parent workflow. The mappings are also fine.

    Is there any other configuration that I need to perform to rectify this issue?

    Please help me.

    Thanks,

    RV

     

  • Hi Rohit,

    You dont need to perform any additional configuration. Please compare the workflow definition Id of the child workflow and  is correctly added in the parent workflow.

    if you are facing this issue to an already existing workflow instance, please create a new one and check. Workflow definitions are versioned and the instance showing error might be referring to an older version.

    thanks.

    Venugopal