Tutorial: Leo’s choice (Routing and rules)

Sometimes, flow diagrams do not follow a straight linear path – the flow may split into two or more paths; only one of which is executed, based on preconditions. For example, let’s say you are working on an insurance approval claim – the flow can follow one route if the person to be insured has children, and another if the person to be insured has no children. You can also nest business rules. For example, if the children are under five years, the flow takes yet another route. In programming parlance, this is similar to the switch statement.

Let’s build a simple app to see how conditional routing works. We will build an app that asks an user (Leo) if he wants to choose between the red pill or the blue pill. Based on his input, the flow will follow one of two possible execution paths.

Let’s get building!

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.

This is what our canvas will look like, once we are done:

Here is a link to the app (https://flow.manywho.com/36f7b1b2-81b1-4806-a5af-820c0e9a764e/play/default/?flow-id=d30d1c01-58f4-4f59-9d43-d57277b2512b), if you would like to try it yourself.

What we need

  1. Boomi Flow username/password. (If you do not have a Boomi Flow login, please click here to request one.)

Building the page for Leo’s input
  1. Create a new flow and give it a name. Example: Leo’s choice.
  2. Open the flow, and drag a Page element from the sidebar to the canvas.
  3. In the Configuration Panel, copy-paste the text Question in the Name field.
  4. Click New Page Layout.

    This opens a tab called New Page. We will configure the page now.
  5. Click the gears icon on the right-hand-side.

    This opens the Settings panel for the page.
  6. Write Question in the Name field and click Save to save the name of the page. (The page label is visible to the user. We will not add a label to this page.)
  7. We will save the page layout now. Click the Save icon the right-hand-side navigation to save the page.

    The page name changes to Question.
  8. From the Input section in the sidebar, drag a Presentation component into the Main container.

    This opens the Page Component configuration panel.
  9. Enter Text here in the Name field.
  10. Copy-paste the following text in the Content field: Welcome to the real world, Leo. This is the only chance you have left. One decision. You can not turn back to the beginning after this. If you take the blue pill – this story ends. You wake up in your arm chair, and write this off as a dream. If you take the red pill – you join Alice in a wonderland, and follow the white rabbit to the end of the hole. Enter ‘Red pill’ or ‘Blue pill’ below.
    You can style the text if you like as well.
  11. Click Save Component.
  12. This is what the page layout looks like now:
  13. From the Input section in the sidebar, drag a Input component into Main container below the Presentation component.
  14. This opens the Configuration Panel for the Page Component. Write Enter choice in the Name and Label fields.
  15. Under Settings, check the boxes for Editable and Required.
  16. Under Size, write 25 in the Size field and 255 in the Maximum Characters field.
  17. In the State section, make sure the Save the whole section box is checked.
  18. Click Select or create a new Value.
  19. Click Create a new Value.
  20. Type Choice in the Name field.
  21. The What kind of Value is this field should say String.
  22. Click Save.
  23. Click Save Component.
  24. Click the Save icon the right-hand-side navigation to save the page. This is what the page looks like now:
  25. Click your flow’s tab to go back to the canvas, and click Save Page.

    This is what the canvas looks like now:

Creating the first outcome
  1. Hover your mouse on StartThe mouse pointer changes from a crossbar to a hand.
  2. Drag an arrow from Start to Question.
  3. In the Configuration Panel, type Go in the Name text field and click Save Outcome.

    This creates an arrow from Start to Question, with the legend Go on it. This is what the canvas looks like now:

Creating the decision
  1. Drag a Decision element from the sidebar to the canvas.
  2. Write Route in the Name field in the configuration panel and click Save Decision.

We will come back and configure the decision once we have created the outcomes.


Creating the outcome for the page
  1. Drag an arrow from Page to Decision.
  2. In the Configuration Panel, type Go in the Name and Label fields.
  3. Click Save Outcome.

This is what the canvas looks like now:


Flow outcome – Red pill
  1. Drag a Step element from the sidebar to the canvas.
  2. Enter Red pill in the Name field.
  3. Copy-paste this text in the content editor: You have taken the red pill. Welcome to Wonderland. Wait for your mission.
  4. Click Save Step.

This is what the canvas looks like now:


Flow outcome – Blue pill
  1. Drag a Step element from the sidebar to the canvas.
  2. Enter Blue pill in the Name field.
  3. Copy-paste this text in the content editor: You have taken the blue pill. A pity. Our story has to end here. Fare thee well, Leo. 
  4. Click Save Step.

This is what the canvas looks like now:


Creating the outcome – If Leo chooses the red pill
  1. Drag an arrow from Decision to Red pill.
  2. In the Configuration Panel, type Red pill in the Name field.
  3. Click Save Outcome.

This is what the canvas looks like now:


Creating the outcome – If Leo chooses the blue pill
  1. Drag an arrow from Decision to Blue pill.
  2. In the Configuration Panel, type Blue pill in the Name field.
  3. Click Save Outcome.

This is what the canvas looks like now:

Tip: You can select an outcome, and move it around the Canvas. For example, if you select the ‘No’ arrow, you get a green box that you can click and drag around to reposition the outcome as needed.

Adding the business rules

Now that we have the steps that are the results of the outcomes, and the outcomes, we can go back to the Decision element and configure the business rules that determine how the outcomes are executed.

  1. Double-click the Decision element. This opens the configuration panel on the right.
  2. Click the pencil icon in Actions next to the Red pill outcome.
  3. Open the + icon to open the Advanced section, if it is not expanded. Click Edit Business Rules.
  4. Click New Rule.
  5. Click Select or create a new value.
  6. Type Choice in the Search bar and select the Choice value.
  7. Click the arrow in the rule logic box, and select the = sign.
  8. Click Select or create a new Value.
  9. Click Create a new Value.
  10. Enter Leo’s choice in the Name field.
  11. The What kind of Value is this? field should say String.
  12. Type Red pill in the Default Value field.
  13. Click Save.
  14. Click Save to save the business rule.
  15. Click Apply Outcome.
  16. Click Save Decision.

This is what the canvas looks like now:

Let’s run the flow now, and see how easily it converts into an app.


Appchievement!

It took us just a few minutes to build an app that uses conditional routing.

This is what the first screen of the app looks like on a browser:

Now, let’s say you enter ‘Red pill’, and click Go. This is the screen that follows:

What if you had entered ‘Blue pill’?

For the sake of simplicity, we are assuming there is no third option. We can always add a new business rule (and subsequent outcome and flow path) to account for a scenario where the user does not enter either ‘Red pill’ or ‘Blue pill’, but goes with say ‘Pink elephant’, an option not included in the choice.

Also note, because we have only two outcomes here, we do not need a second business rule, checking if the user has entered ‘Blue pill’. The flow automatically takes the blue pill execution path if the user has not entered ‘Red pill’.


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.

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.