Articles in this section

Managing Context Variables

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

  1. To create a custom context variable, click on the Context Variable button located at the top right of the screen.
    CV icon.png
  2. 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.
  3. Click Add Context on the bottom left.
  4. 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.

Screenshot 2024-05-30 at 10.38.57 AM.png

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:

    1. Go to Solve > Workflow Builder.
    2. In the upper right corner of your Forethought dashboard, click on the Context Variable icon to open the Context Variable drawer.
      CV icon.png
    3. Set the variables you want to add to the code snippet as Pre-defined. Then, click Save 
      alt
    4. 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.   
      alt

 

Was this article helpful?
0 out of 1 found this helpful

Comments

0 comments

Article is closed for comments.

Support

  • Need help?

    Click here to submit a support request. We are here to assist you.

  • Business hours

    Monday to Friday 8am - 5pm PST excluding US holidays

  • Contact us

    support@forethought.ai