Tutorial: Routing control back-and-forth between two flows

Content under development

You can jump into a second flow in your tenant from within a flow, by creating a subflow. This lets you transfer control back and forth between the two flows – which means an user can start in Flow A, do something in Flow B, and go back to Flow A if required.

There are several advantages of jumping from one flow to another. Say, you want to build an app for employee onboarding. Once a new employee joins, there are several things that need to happen simultaneously. She needs to be given an email/password and entered into the company email system, she needs to be assigned a desk, she needs to be requisitioned a telephone/new computer, payroll needs to add her, her benefit details need to be confirmed, and so on. If you create a subflow for each of these processes, it becomes easier to manage dependencies; HR can complete their part without waiting for IT, for example.

Let’s get building!

What we will need:

Creating the child flow

We will start with creating the subflow first; so we can use the Flow ID of this flow in the parent flow.

  1. Create a new flow called Child flow using the ManyWho Identity service.
  2. Create a step with the name Welcome to the subflow and content This is the subflow. Yay! 
  3. Create an outcome connecting the Start element with the Step element.
    This is what the canvas looks like now:
  4. Click Shared Elements and import the ManyWho Runtime service to your flow.
  5. Click the Publish icon to publish the flow. Note the Flow ID of the flow.

Creating the parent flow
  1. Create a new flow called Parent flow using the ManyWho Identity service.
  2. Click Shared Elements and import the ManyWho Runtime service to your flow.
  3. Create a step with the name Welcome to the parent flow and content This is the parent flow.
  4. Connect the Start element and the Step element with an outcome. This is what the canvas looks like now:
  5. Let us create the message action now. This is how we will switch the execution path from the parent flow to the child flow. Drag a Message element from the sidebar to the canvas under the Step element.
  6. In the Configuration Panel, copy-paste the text Start subflow in the Name text field and click New Message Action.
  7. Select Runtime as the service to send the message.
  8. Select the Execute Flow action.
  9. Click Select or create a new Value for FlowID in Inputs.
  10. Click Create a new Value.
  11. In the Name field for the value, type Flow ID – Child flow.
  12. The What kind of Value is this field should be String.
  13. Copy-paste the Flow ID from the child flow you created earlier in the Default Value field. Make sure there are no trailing spaces.
  14. Click Save.
  15. Click Select or create a new Value for PassMatchingValuesIntoFlow in Inputs.
  16. Select the $True Boolean value.
  17. Click Select or create a new Value for State for State in Outputs.
  18. Click Create a new Value.
  19. In the Name field type State – Child flow.
  20. The What kind of Value is this field should be Object.
  21. Click Select a Type.
  22. Select State. This is what the configuration looks like:
  23. Click Save to save the value.
  24. Click Apply Message Action.
  25. Click Save Message.

    This is what the canvas looks like now:
  26. Drag a Step element to the canvas next to the message.
  27. Type Child flow – details in the Name field.
  28. In the content editor copy-paste the text Here is some information about the flow B you just started.
  29. In the next line, type Join here:
  30. Click Insert Value.
  31. Select State – Child flow/Join Uri.

  32. Click Ok to insert the value in the content editor.
  33. Type Process started:

  34. Click Insert Value again.
  35. Select State – Child flow/Date Created.
  36. Click Ok.
  37. Click Save Step.

    This is what the canvas looks like now:
  38. Drag a Step element into the canvas next to the Welcome to the parent flow element.
  39. Type Parent flow – Next Screen in the Name field.
  40. In the content editor, type This is the next screen of the parent flow.
  41. Click Save Step.
  42. Create an outcome from Welcome to the parent flow element to the Start subflow element called Start child flow. This is what the canvas looks like now:
  43. Create an outcome from Start subflow to Child flow – details called Go. This is what the canvas looks like now:
  44. Create an outcome from Child flow – details to Parent flow – Next screen called See next screen in Flow A. This is what the canvas looks like now:
  45. Create an outcome from Parent flow – Next screen to Welcome to the parent flow called Back. This is what the canvas looks like now:
  46. Create an outcome from Welcome to the parent flow to Parent flow – Next screen called Next screen in Flow A. This is what the canvas looks like now:
  47. Click the Publish icon to publish the flow.

That was fast!

It took us around 20 minutes to build two flows and routing control back-and-forth between them.

Let’s run the parent flow now, and see how easily it converts into an app, which can jump back-and-forth between two flows.


Appchievement!

This is what the first screen of the app looks like:

Let’s click the START CHILD FLOW option. This starts executing the child flow:

We will now go back to the parent flow now:


If you need to take a closer look, click on the images to enlarge them. Have a question? Click the Help button on the bottom right-hand corner of this page to ask.

Check out the glossary for a definition of terms and key concepts that appear in the Boomi Flow website, Drawing Tool, technical documentation, blogs, and marketing communications.