Skip to main content

Save content in variables using the Set Variable block

Overview

The Set Variable Block allows you to assign values to your variables, build creative flows, and pass relevant information about the chatter's conversation to your agents. With the Set Variable Block, you can work with variables dynamically, such as saving a variable with a new value or creating new variables entirely and providing them with values.

Set_Variable_Block___served___True.png

Here are some sample use cases of the Set Variable Block:

  • {variable} = {variable}

    Save a global variable with the content of a metavariable in order for it to be passed to Zendesk using the Zendesk Ticketing Block.

  • {variable} = {basic}

    In an answer flow that requires the chatter speak with an agent, the Set Variable Block can be used to save a text or number variable with specific text content. This newly saved text content can subsequently be used by your interactive voice response (IVR) or live chat systems to route chatters to the appropriate queues and provide your agents with additional context of the chatter’s conversation.

    You can set a text variable with a number value or a number type variable; however, please note that the value will be saved with a decimal point.

  • {variable} = {true/false}

    Save a global yes or no variable with a True or False value to guide your chatters to specific answers. For example, imagine that you have an Order Tracking flow with multiple Capture Blocks. If your chatters keep clicking the No thanks or Never mind quick reply buttons to exit the flow and are frustrated that they seem unable to track their orders. You can set a "from_order_tracking" global boolean variable to true at the start of the Order Tracking flow, and use a Conditional Block in the Cancel Capture answer to redirect chatter to a second (hidden) Order Tracking answer flow.

Use the Set Variable block

In the Answers View, drag and drop a Set Variable Block from the block drawer into an answer. The Set Variable Block can be inserted directly into an answer or it can be nested within Scheduled Blocks or Conditional Blocks.

For each variable row within the block, there will be two fields to complete, the Variable and the Content.

  • Variable - this field on the left side of each row is a drop-down menu where you select the variable you want to overwrite. Please note that you will not be able to select metavariables or list type variables.

  • Content - this field on the right side of each row is where you input the content that you want to overwrite the variable with.

Screen_Shot_2020-04-15_at_7.45.53_AM.png

Content types

There are four supported content types: Basic (default), Variable, True/False, and Null. Click the three dots to the right of each Content field to change the content type.

Screen_Shot_2020-04-15_at_1.03.19_PM.png
  • Basic

    This content type is a static text input that you add manually.

    Screen_Shot_2020-04-15_at_1.04.39_PM.png
  • Variable

    A variable can be overwritten with the content of another existing variable. For example, you can save a newly created global text variable with the content of an existing metavariable.

    Screen_Shot_2020-04-15_at_7.58.26_AM.png

    Please note that you will not be able to save a variable with the value of an authentication (OAuth type) variable, as this could result in a security issue with your bot.

  • True/False

    A yes or no variable can be assigned a content of true or false.

    Set_Variable_Block___served___True.png
  • Null

    A variable can be assigned content that is null.

    Screen_Shot_2020-04-09_at_9.58.44_AM.png

Add Additional Variables

You can add additional variables to the Set Variable Block by clicking the + Add new variable at the bottom of the block.

Set_Variable_Block___callout_to_Add_new_variable.png

If there are more than five variables within the block it will be collapsed by default the next time you view the Answer. This allows you to more easily scroll through the Answer's content. To expand the block and view all of the variables, however, click the arrow icon next to the trash can icon in the upper-right corner of the block.

Have any questions? Contact your Ada team—or email us at help@ada.support.