> For the complete documentation index, see [llms.txt](https://doc.wearepatchworks.com/product-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables.md).

# 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)
