Subroutine basically is a smaller flow for a particular task that is available for repeated use in the large flow.It allows users to create general actions that are reusable in different flows under their accounts.
Similar to Action, subroutine also has Inputs and Outputs which must be declared in advance.
A subroutine flow has the following properties:
- Predetermined input data structure.
- Optional predetermined output data structure.
- All branches of the subroutine flow must end with Subroutine Return action, returning output data with a structure that matches the predefined one.
In order to create a subroutine, please follow the steps below.
- 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
orfalse.
Example:
All branches of the subroutine flow must end with Subroutine Return action
- Select Subroutine Return > Click (+) icon at a bottom of your branch
- Key in output values of each branch > Add
Example:
Finally, a complete subroutine will have subroutine return action at the bottom of all branches.
Add the created Subroutine to other Flows
Example:
1. Select the created subroutine: Get Localized Messages > Click (+) icon at a position you want to add.
2. Configure input parameter > Add
Configure the next Actions as you wish, using outputs of the above subroutine
Example:
Example:
***Requirements:
– If the output of the previous subroutine is English, trigger branch: Caller chose English
– If the output of the previous subroutine is Indonesian, trigger branch: Caller chose Indonesian
– If the output of the previous subroutine is Indonesian, trigger branch: Caller chose Indonesian
In order to fulfill this request, follow the steps below:
1. Select Split Flow by Context > Click (+) icon under Get Localized Messages action
2. At Control Variable, Click the dashes icon to choose the 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
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