When adding Page elements like an input question or a paragraph, you can optionally assign a runtime Rule that dynamically shows or hides the element if the specified Rule condition is met.
Rules enable you to personalize the questions and information that will be displayed to the user according to conditions entered or data used by the current Flow. A show/hide Rule can use a static value or any variable that is available to the Flow.
For example, you may want to present a specific question only to a premium customer, or hide an input option from users on specific days of the week.
When assigning a Rule to an element, you can assign the Rule directly to that element or use a global Rule. For more information on global Rules, see Creating Account Rules.
The following Page elements enable use of show/hide Rules:
- Text input questions
- Number and Date input questions
- Yes/No questions
- Choice and Multiple Selection questions
- Password input questions
- Photo Upload elements
- Navigation Buttons
Note: You can also use show/hide Rules to display specific Choice elements to a user during runtime. For more details, click here.
To create a dynamically displayed element:
- In the element you wish to personalize, click the plus icon on the Show/Hide Rule field:
The Rule Editor will be displayed.
- Click in the left-side variable field, and do any of the following:
- Select a variable or formula from the Variables List,
- Select a global Rule to use from the Variables List,
- Create a new variable (for instructions, refer to Creating User Variables),
- Choose the .elementAt variable from a Collection variable and enter the index location of the item you want to access. (Only simple Collections are supported when using the .elementAt variable.),
- Choose a Dynamic Variable or enter a specific Dynamic Variable path for comparison.
In our example, we've selected the Customer Profile variable to return the service level for the current Flow user.
- Select the required comparison logic (equals, less than, etc.) to be used in evaluating the conditions.
Note: The comparison logic options will change according to the selected variable type. For more information, click here.
- Click in the right-side field and provide one of the following to compare against:
- Enter a set value,
- Enter "@" then select a variable from the Variables list,
- If you are using a global Rule, select one of the Rule outputs that appear in the drop-down list,
- Create a new variable,
- Choose the .elementAt variable from a Collection variable and enter the index location of the item you want to access,
- Choose a Dynamic Variable or enter a specific Dynamic Variable path for comparison. (Available only when a Text or Number value is entered on the left-side).
In our example, we've entered Bronze as the conditional value of the service level.
- Select Show or Hide from the dropdown menu at the right. When the Rule condition is met (for our example, when the Customer Profile) is Bronze), this dropdown determines whether the element is displayed or hidden for the user during runtime.
To remove a Rule, click on the Delete rule trash icon at the top right corner of the Rule Editor.
Using Variables with Dynamic Rules - Another Example
Dynamically show or hiding an element provides useful runtime flexibility when variables are used.
For instance, we can use a simple show/hide Rule to eliminate the need for a customer to re-input their basic ID information when the flow directs them to a sub-Flow.
The following Show/Hide Rule from a Text Input question illustrates this method:
If the Customer ID field is empty when the Flow is run, the Text Input Question will be displayed to request the ID from the user, as shown on the left of the following runtime example:
However, if the Customer ID variable contains a value from the user's previous input (for example, from a prior element in the journey or another Flow), the Text Input Question will be hidden during runtime, as shown above on the right.