Using Local Variables in FlowMattic
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:
- Create Local Variable
- Get Local Variable
- Update Local Variable
- 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
orArray
- 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!