Create Flow - Subroutine

Updated 5 days ago by Hallie

Subroutine is a flow that is triggered by other flows. Subroutine essentially allows users to create their own actions from existing actions of themselves or other providers. Therefore, subroutine provides abstraction and reusability.

Subroutine is like action, also has inputs and outputs. Inputs and outputs must be declared before hand.

A subroutine flow has the following properties:

  • Predetermined input data structure.
  • Optional predetermined output data structure.
  • If the output data structure is defined, all branches of the subroutine flow must end with Subroutine Return action, returning the output data with structure that matches the predefined one.

In order to create a subroutine, please follow the steps below:

  1. Go to Flow App > Click (+) icon

  1. Choose Subroutine > Give your subroutine a name > Configure input and output parameters > Create
  • Input: Input needs to be passed into this subroutine when triggered.
  • Output: output of this subroutine that can be used as an input of later actions.
  • Data type:
    • String: can take both numbers and characters.
    • Number: can take numbers only.
    • Boolean: can only take the values true or false.

Example:

  1. Configure actions for your subroutine flow

Example:

  1. Go to each branch > add Subroutine Return (all branches of the subroutine flow must end with Subroutine Return action)
    1. Touch Subroutine Return > Click (+) icon at a bottom of your branch
    2. Key in output values of each branch > Add
      Example:
      Language & Message are 2 outputs created at the beginning

A complete subroutine will have subroutine return action at the bottom of all branches.

  1. Click Activate to make your subroutine flow active

  1. Now you can use this subroutine for other flows
    1. Add the created subroutine to other flows
      Example:
      1. Touch the created subroutine: Get Localized Messages > Click (+) icon at a position you want to add
      2. Configure input parameter > Add
    2. Configure the next actions as you wish, using outputs of the above subroutine

      Example:

      **Requirements:
      - If output of the previous subroutine is English, trigger branch: Caller chose English
      - If output of the previous subroutine is Indonesian, trigger branch: Caller chose Indonesian

      In order to fulfil this request, follow the steps below:
      1. Touch Split Flow by Context > Click (+) icon under Get Localized Messages action
      2. At Control Variable, click dashes icon to choose output of the previous subroutine > choose Get Localized Messages > Language
      3. Configure Path Options (make sure that you type in the exact output values of the previous subroutine) > Add
      4. Go to each branch > configure the next actions as you wish


How did we do?


Powered by HelpDocs (opens in a new tab)

Powered by HelpDocs (opens in a new tab)