# Initialising a process flow manually with a payload

## Introduction

The `initialise flow (advanced)` option can be used if you want to run a process flow immediately with a given payload in a single operation - it's particularly useful if you are sending data into Patchworks via the [Patchworks API](https://doc.wearepatchworks.com/product-documentation/process-flows/managing-process-flows/broken-reference) or a [webhook](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/trigger-shape/trigger-shape-webhook) and need to test a process flow with specific data.

{% hint style="warning" %}
Before initialising a process flow manually, make sure that you won't be duplicating data, or causing duplication next time the process flow runs according to trigger settings.  &#x20;
{% endhint %}

{% hint style="info" %}
If the virtual environments feature is enabled, you can also use the `initialise flow (advanced)` option to run the process flow against a given virtual environment - for more information, please refer to [Testing a process flow against a virtual environment](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/testing-a-process-flow-against-a-virtual-environment).
{% endhint %}

## Need to know

* The maximum number of characters for a single payload is 100k. Anything larger than this may cause the process flow to fail.
* Your subscription tier determines the number of process flow runs that can be started per minute - please see [Core subscription tiers](https://doc.wearepatchworks.com/product-documentation/getting-started/core-subscription-tiers) for information.
* When working with `draft` process flows, you cannot edit shapes while the flow is being run manually.

## The steps

To initialise a process flow manually with a payload, follow the steps below.

## Using the initialise flow (advanced) option

{% stepper %}
{% step %}
[Access the first process flow](https://doc.wearepatchworks.com/product-documentation/process-flows/accessing-your-process-flows) that you want to run, so it's displayed on the canvas. If necessary, use the [versions panel in process flow settings](https://doc.wearepatchworks.com/product-documentation/building-process-flows/process-flow-versioning#accessing-process-flow-versions) to switch to the required flow version.
{% endstep %}

{% step %}
**Select the initialise flow (advanced)**

Select the `initialise flow (advanced)` option from the actions bar - for example:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F4Jtyu5vFuyzfWrlpJxzH%2Ftest%20flow%20with%20ve%201.png?alt=media&#x26;token=0dd5c9fa-b3eb-4940-a832-571eacc82170" alt=""><figcaption></figcaption></figure></div>

The `initialise flow (advanced)` page is displayed:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FtC3vXP0L0z86AywvEWE1%2Fadvanced%20run%201.png?alt=media&#x26;token=35489161-0b76-4423-9cb9-04bbf912ae86" alt=""><figcaption></figcaption></figure>

Here, the left panel can be used to pass in a specific payload, and the right panel shows whether [flow](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables) and/or [environment values](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version/configuring-virtual-environment-replacements/replacement-variables) are present.
{% endstep %}

{% step %}
**Apply payload**

Paste your required payload into the `payload` panel - for example:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FWUavBBvovjX4KTGOIxi7%2Fadvanced%20run%20with%20payload%201.png?alt=media&#x26;token=555b7787-1509-4631-a9aa-1c5d5539762b" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Review flow variables (if applicable)**

If flow variables are present in the current flow version, a `flow variables` section is displayed -click the associated arrow to display any [flow variables](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables) defined for the current version - for example:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F2KpLqqVE3UymqgaJa1fK%2Fadvanced%20run%203.png?alt=media&#x26;token=4d376449-5831-41ed-a612-bc7669347ac8" alt=""><figcaption></figcaption></figure>

If required, you can use the associated toggle option to override the current variable value - for example:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FTc7eip0ICCyyoizC61S0%2Fadvanced%20run%203a.png?alt=media&#x26;token=22d80922-2c09-4aa1-a210-30ee70271d05" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Any value specified here is applied for this run only.
{% endhint %}
{% endstep %}

{% step %}
**Review virtual environment variables (if applicable)**

If a `virtual environment variables` section is displayed, it means that at least one virtual environment is deployed for your company profile. Click in the `virtual environment` field and select the environment that the current flow should run against - for example:&#x20;

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FIsxNN6qHvxVoEW45tHsD%2Fadvanced%20run%203b.png?alt=media&#x26;token=110289fb-0975-4946-899a-1313c0617923" alt=""><figcaption></figcaption></figure>

Any replacement environment variables configured for the selected virtual environment are listed below - for example:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F2MXcz2f6RpUvU6jOhAuo%2Fadvanced%20run%203c.png?alt=media&#x26;token=0ebf4939-0858-4c78-b2bd-ed7c38a94cce" alt=""><figcaption></figcaption></figure>

If required, you can use the associated toggle option to override the current variable value - for example:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F33nMyauwJcog7FSHZhNy%2Fadvanced%20run%203d.png?alt=media&#x26;token=eb818ab6-ca49-4e09-a208-0c1da4ec8446" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Any value specified here is applied for this run only. For more information, please see [Testing a process flow against a virtual environment](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/testing-a-process-flow-against-a-virtual-environment).
{% endhint %}
{% endstep %}

{% step %}
**Run the process flow**

Click the `initialise flow` button at the bottom of this page:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FmkvYf1iHmEZO8YWGkbAc%2Fadvanced%20run%205.png?alt=media&#x26;token=58b53dc1-ce75-423b-aa12-6f374bb30617" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Check the logs and generated payloads to ensure that results are as expected. When you're satisfied that the process flow is running correctly, you can [deploy it to the virtual environment](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-a-single-process-flow-to-a-virtual-environment).
{% endstep %}
{% endstepper %}

## Related pages

* [Initialising a process flow manually with a payload](https://doc.wearepatchworks.com/product-documentation/process-flows/managing-process-flows/initialising-a-process-flow-manually-with-a-payload)
