Articles in this section
Category / Section

Using Local Variables in FlowMattic

3 mins read
Updated:

The Local Variables feature in the FlowMattic Tools module lets you create, retrieve, update, and delete temporary variables within a single workflow. These variables exist only during the execution of a workflow and can be incredibly useful for storing and manipulating values on the fly.


๐Ÿ” Where to Find This Feature

Local Variables are part of the FlowMattic Tools module. When creating or editing a workflow, choose an action, search for โ€œFlowMattic Toolsโ€, and select one of the available Local Variable actions.


๐Ÿงฐ What Are Local Variables?

Local variables are temporary variables that:

  • Are accessible only during the current workflow execution
  • Can be used to store static values, intermediate results, or data across steps
  • Support two types:
    • String โ€“ A single text or numeric value
    • Array โ€“ A collection of key-value pairs

๐Ÿ”ง Available Actions

There are four key actions available:

  1. Create Local Variable
  2. Get Local Variable
  3. Update Local Variable
  4. Delete Local Variable

Letโ€™s walk through each of them step by step.


1๏ธโƒฃ Create Local Variable

Use this action to define and initialize a local variable.

๐Ÿ”น Configuration

  • Variable Name โ€“ A name for your variable (e.g., my_custom_variable)
  • Variable Type โ€“ Choose String or Array
  • Variable Values:
    • If String, provide a single value
    • If Array, provide multiple key-value pairs

โœ… Example (Array)

{
  "product": "FlowMattic",
  "quantity": 1
}

๐Ÿ” Response

{
  "status": "success",
  "variable_id": "a08d289c6e94207f1f1b8388fd6e8b3e",
  "value": {
    "product": "FlowMattic",
    "quantity": 1
  }
}

Note: The variable_id will be used in subsequent steps to access this variable.


2๏ธโƒฃ Get Local Variable

Retrieve the value of a previously created variable using its ID.

๐Ÿ”น Configuration

  • Variable ID โ€“ Use dynamic tag like {tools2.variable_id}

โœ… Example Usage

Use this step to get values and pass them to a webhook, email, or conditional logic.


3๏ธโƒฃ Update Local Variable

Modify the value of an existing variable.

๐Ÿ”น Configuration

  • Variable ID โ€“ Use the ID from the โ€œCreateโ€ step
  • Variable Type โ€“ Must match the original type
  • Updated Values:
    • You can change any key or add new ones

โœ… Example Update

{
  "product": "Updated Name",
  "quantity": 2
}

4๏ธโƒฃ Delete Local Variable

Removes a variable completely from the workflow memory.

๐Ÿ”น Configuration

  • Variable ID โ€“ Use dynamic tag like {tools4.variable_id}

Once deleted, the variable is no longer available for the remainder of the workflow run.


๐Ÿงท Use Case: Storing Static Data

Sometimes you need to reuse static data (like constants) across multiple steps.

โœ… Example

Create a variable:

{
  "company_name": "FlowMattic",
  "support_email": "[email protected]"
}

Now, instead of entering these values again and again, you can just use Get Local Variable wherever needed.

๐Ÿ’ก Use Case

Send a thank-you email with the company name and email, then log the entry with the same details using a webhook.


๐Ÿ’ก Real-World Use Cases

โœ… Basic Use Cases

  • Store and reuse user input like name or email
  • Carry temporary values between steps
  • Hold static information like support details or tax rates

๐Ÿš€ Advanced Use Cases

  • Build custom payloads for API calls step-by-step
  • Store filter results from Google Sheets or Airtable temporarily
  • Store status flags (e.g., status = success) to use in conditional paths
  • Use as counters (e.g., loop_count += 1) for iterations

๐Ÿ“˜ Summary

Action Purpose
Create Define a new variable
Get Retrieve the value for further use
Update Modify contents of an existing variable
Delete Remove the variable from memory

Let us know if you have any questions about using Local Variables in FlowMattic!

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Access denied
Access denied