Skip to main content

Set Variable Action

The Set Variable action stores a value in a variable for use in later workflow steps. Use this to calculate values, transform data, or store intermediate results.

Jerome Bajou avatar
Written by Jerome Bajou
Updated over a month ago

Overview

The Set Variable action stores a value in a variable for use in later workflow steps. Use this to calculate values, transform data, or store intermediate results.


Configuration

Variable Name (Required)

Name for the variable. Must:

  • Start with a letter or underscore

  • Contain only letters, numbers, and underscores

  • Be unique within the workflow

Examples:

  • total_price

  • customer_full_name

  • discount_amount

  • _temp_value

Value (Required)

Value to store. Supports:

  • Variables from previous steps

  • Functions and calculations

  • Text with variable interpolation

  • Nested expressions

Examples:

{sum(booking.price, booking.tax)} 
{upper(customer.name)}
Hello {customer.name}
{formatDate(booking.date, 'Y-m-d')}

Use Cases

  • Calculate totals or discounts

  • Format data for later use

  • Store intermediate calculations

  • Combine multiple values

  • Transform data formats


Examples

1. Calculate Total

Variable Name: total_price 
Value: {sum(booking.price, booking.tax, booking.tip)}

2. Format Customer Name

Variable Name: full_name 
Value: {upper(customer.name)}

3. Calculate Discount

Variable Name: discount 
Value: {multiply(booking.price, 0.1)}

4. Combine Text

Variable Name: greeting 
Value: Hello {customer.name}, your booking {booking.id} is confirmed.

5. Format Date

Variable Name: formatted_date 
Value: {formatDate(booking.date, 'F j, Y')}

Using Variables

After setting a variable, use it in subsequent steps:

{total_price} 
{full_name}
{discount}

Best Practices

  1. Use descriptive names - Make variable names clear

  2. Validate calculations - Test math operations

  3. Handle empty values - Use fallback values when needed

  4. Reuse variables - Store frequently used values


Related Documentation

Did this answer your question?