# Flow variables

## Introduction

If your process flow includes a [connection shape ](/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape.md)that's configured for an endpoint where a variable can be entered, you'll probably be used to entering a static value to be applied for that step - for example:

![](/files/tjQKTsV7t9XRM6rZFBQ5)

You might also be familiar with [obtaining variable values dynamically, from a payload](/product-documentation/process-flows/building-process-flows/dynamic-variables/payload-variables.md). However, **flow variables** provide another level of flexibility.&#x20;

Flow variables provide the ability to define variables at the process flow level, and then reference these values throughout the entire process flow. You set a flow variable once, and it is applied throughout the entire process flow, wherever it is referenced.&#x20;

When flow variables are modified - either manually or via a script - those updates are applied anywhere in the process flow where they are referenced, automatically.

{% hint style="info" %}
You can also reference flow variables in [custom scripts](/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables/referencing-flow-variables-in-custom-scripts.md) (which means you can manipulate these values however you need) and also in [field mapping transformations](/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables/referencing-flow-and-meta-variables-in-mapping-transformations.md). &#x20;
{% endhint %}

## Need to know

Before you start working with flow variables, there are a couple of important points to understand regarding [process flow versions](#process-flow-versions) and [update persistence](#update-persistence).

### Process flow versions

Flow variables are version-specific. For example, if you add flow variables to the current `draft` version and later restore an inactive version to `draft`, any defined flow variables won't be present. So, make sure you're updating the correct version of a process flow. For more information, please see our [Process flow versioning](/product-documentation/process-flows/building-process-flows/process-flow-versioning.md) page.

### Update persistence

If you update a flow variable [via a script](/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables/referencing-flow-variables-in-custom-scripts.md), those updates persist for the duration of the flow run. Once the process flow has been completed, default values are restored.

## Using flow variables

Please see the following pages:

* [Adding & managing flow variables](/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables/adding-and-managing-flow-variables.md)
* [Referencing flow variables in a process flow](/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables/referencing-flow-variables-in-a-process-flow.md)
* [Using flow variables in custom scripts](/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables/referencing-flow-variables-in-custom-scripts.md)
* [Referencing flow variables in mapping transformations](/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables/referencing-flow-and-meta-variables-in-mapping-transformations.md)

{% hint style="info" %}
When defining variables you can 'mix and match' [payload](#variables-and-parameters-from-payload-syntax), [metadata](/product-documentation/process-flows/building-process-flows/dynamic-variables/payload-variables.md#variables-and-parameters-from-payload-metadata) and **flow** variables. For example:

![](/files/0i35OD1HXancx84C0Z3s)
{% endhint %}

## Related information

* [Payload variables](/product-documentation/process-flows/building-process-flows/dynamic-variables/payload-variables.md)
* [Metadata variables](/product-documentation/process-flows/building-process-flows/dynamic-variables/metadata-variables.md)
* [Generating dynamic cache keys with variables](/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/add-to-cache-shape/generating-dynamic-cache-keys-with-variables.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
