Set variable

Set, add to or clear variables: counters, flags, copies of answers and values built from other variables.

On this page

Changes one or more variables, in order, then moves on. Nothing is sent to the contact.

The Set variable step's settings

Assignments

Each line picks a Variable and an Action:

ActionDoes
Set toStores the Value: text, a number, or variables ({{first_name}} {{last_name}}). It's converted to the variable's type: "12" into a number variable becomes 12.
AddAdds a number to the variable (1 when the value is empty; negative to subtract). An empty variable counts as 0.
ClearEmpties the variable.

When the value is exactly one variable, like {{order}}, the value is copied as it is, so data (JSON) stays data and a number stays a number.

If a value can't be converted (text into a number variable, say), the variable is left unchanged and test mode shows a warning.

Built-in values (contact.*, sys.*) are read-only. To save the contact's name, use Update contact.

Output

OutputWhen
NextAlways.

Examples

  • Count visits: visits (a number kept on the contact), Add 1. A Condition can then greet returning contacts differently.
  • Remember a path: came_from Set to menu, before jumping to a shared part of the flow.
  • Start over: Clear the answers before asking the questions again.

Still stuck?

Ask us. We read every message.

Privacy