Context variables enable you to define, store, and transfer various values within your workflows. This article will explain how to create and utilize pre-built and custom context variables in Workflow Builder.
Create Custom Context Variables
- To create a custom context variable, click on the Context Variable button located at the top right of the screen.
-
The context variable drawer allows you to create, delete, and manage mapping variables. Within this drawer, you'll find several prebuilt context variables that come with different types and predetermined names. These default variables are always available for use but cannot be edited.
- Click Add Context on the bottom left.
- Choose a display name for the variable and the variable's data type. Each data type serves a unique purpose, so be sure to select the correct type for each variable. The available options for the data types are:
-
-
- Short Text: used for smaller text inputs, such as names.
- Long Text: used for longer text inputs, such as descriptions.
- Checkbox: a simple checkbox that is used for boolean values - True/False.
- Number: any number, whether an integer or a decimal value.
- Email: used for email domain inputs.
- Phone: used for phone number inputs.
- List: used for drop-down selections.
- Multi-Select List: used for multiple drop-down selections
- Date: used for dates, stored in ISO 8601 format (yyyy-mm-dd).
-
Note: If an admin attempts to enter incorrect input into a variable, such as a name into an email field, the system will prevent them from proceeding until the input is corrected.
Use Context Variables in Workflows
After creating your custom variables, define and use their values in a workflow. To do this, reference any variable by typing out its name preceded by a dollar sign ($). For example, $Email, $First Name, $Phone, etc. You can also assign a value to a context variable through the widget snippet, either dynamically or statically. Context variables can be used in several ways within Workflow Builder, including:
- Adding variables to most text fields
- Using forms to collect user inputs and store them
- Adding variables to Handoff and API Actions
Use Drop-Downs in Workflow Builder
The list-type context variable allows you to create a dropdown in the workflow builder. You can give the context variable a name and then input a list of possible values for that variable, which will make up the dropdown options.
Set Context Variables in the Embed Script/Code Snippet
Using pre-defined and a code snippet, you can set the value of a context variable before the widget conversation begins. To do this, follow the steps below:
- Go to Solve > Workflow Builder.
- In the upper right corner of your Forethought dashboard, click on the Context Variable icon to open the Context Variable drawer.
- Set the variables you want to add to the code snippet as Pre-defined. Then, click Save.
- After saving your changes, go to Solve > Configuration > Embed. To set the context variable in your webpage, work with your developer using the provided code snippet. You can set these variables dynamically for user-dependent values, such as email addresses, or keep them constant for domain-specific variables.
Comments
Article is closed for comments.