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.Context Variable.png
  2. The context variable editor drawer will open.

    List of CV.png

    The drawer is where you can create, delete, and manage the parameters and variables for your workflows. You'll find several prebuilt variables with different types and predetermined names. These default variables are always available and 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 administrator 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 Variables in the Embed Script/Code Snippet

Using workflow context and a code snippet, you can set the value of a context variable before the widget conversation begins.

  1. Set the variables you want to add to the code snippet as "Workflow Context" in the Context variables page
  2. After saving your changes, the Embed Section of the Widget Configuration page will show you how to set the value of those variables, as well as the rest of the embed script. alt You can either set these dynamically for variables that are user-dependent, such as email, or leave them constant for variables that are domain-specific.
Was this article helpful?
0 out of 0 found this helpful

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