# Deploying a single process flow to a virtual environment

## Introduction

You can deploy any version of a process flow to any virtual environment.

This page provides instructions for deploying process flows in the context of virtual environments. Before deploying process flows to virtual environments for the first time, it's important to understand how flow versioning works -  if you're not already familiar with this, please see [Understanding flow versioning for virtual environments](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-a-single-process-flow-to-a-virtual-environment/understanding-flow-versioning-for-virtual-environments).

{% hint style="info" %}
If you need to deploy multiple process flows, adding them to a [package](https://doc.wearepatchworks.com/product-documentation/virtual-environments/virtual-environment-packages) of flows for deployment is more efficient. For further information, please refer to our [virtual environment packages](https://doc.wearepatchworks.com/product-documentation/virtual-environments/virtual-environment-packages) section.&#x20;
{% endhint %}

{% hint style="warning" %}
If you do NOT use virtual environments, different instructions apply; please refer to [Deploying a process flow (without virtual environments)](https://doc.wearepatchworks.com/product-documentation/process-flows/managing-process-flows/flow-deployment/deploying-a-process-flow-without-virtual-environments).
{% endhint %}

## Need to know

* A process flow can be deployed to any given [virtual environment](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-a-single-process-flow-to-a-virtual-environment) (or to `no environment` ) once. If you attempt to deploy a flow and an existing version is detected, you are prompted to overwrite the existing version as part of the deployment operation.&#x20;
* Any version of a given process flow can be deployed to any number of virtual environments.
* By default, a flow version is deployed AND `enabled`, which means it runs according to any defined trigger settings immediately (i.e. it's 'live'). If you aren't ready for a deployment to be live, you can deploy and `disable`.&#x20;
* When a process flow is deployed to a virtual environment, it runs against the current [deployed configuration version for that environment](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-the-configuration-for-a-virtual-environment). &#x20;
* If a process flow includes a [run process flow](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/run-process-flow-shape) shape, the 'called' flow must be deployed to the same virtual environment. If a 'called' process flow can't be found in the same environment, an error is given, and the flow will fail.&#x20;

{% hint style="info" %}
For detailed information about how versioning works with process flows in virtual environments, please refer to [Understanding flow versioning for virtual environments](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-a-single-process-flow-to-a-virtual-environment/understanding-flow-versioning-for-virtual-environments).
{% endhint %}

## Deploying a process flow to a virtual environment

{% stepper %}
{% step %}
**Access the required process flow**

[Access the first process flow](https://doc.wearepatchworks.com/product-documentation/process-flows/accessing-your-process-flows) that you want to deploy.
{% endstep %}

{% step %}
**Open process flow settings**

Select the settings icon from the actions bar:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FOFJTDWWRNax3U1qbpQHx%2Fdeploy%20flow%201.png?alt=media&#x26;token=0bb2db00-cf0d-478f-82f3-f0adc568413c" alt="" width="375"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**View deployments**

Scroll down to the [versions panel](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-a-single-process-flow-to-a-virtual-environment/understanding-flow-versioning-for-virtual-environments/reviewing-version-information-for-virtual-environment-process-flows) and click the `view deployments` option:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fz4AQSPhjb7bJtL0jIjOf%2Fview%20deployments%201.png?alt=media&#x26;token=c4e6da45-cdf4-4ca0-99c1-d6d183eb72c7" alt=""><figcaption></figcaption></figure>

The `view deployments` page is displayed:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FR8gNPZWjKiCOpkmzpg5w%2Fview%20deployments%202.png?alt=media&#x26;token=fa8e6de8-b4e0-4398-b315-df0c50895af9" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
For more information about the `view deployments` page, please see [Reviewing version information for process flows](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-a-single-process-flow-to-a-virtual-environment/understanding-flow-versioning-for-virtual-environments/reviewing-version-information-for-virtual-environment-process-flows).
{% endhint %}
{% endstep %}

{% step %}
**Choose an environment**

Click in the `environment` field and select the required virtual environment from the dropdown list - for example:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F3OcMTgeuulylfcsqtEX9%2Fview%20deployments%203.png?alt=media&#x26;token=de8adb6e-54e8-4263-b776-9e62110b3383" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If necessary, you can deploy a flow version without selecting an environment. This deploys and (if selected) [enables](https://doc.wearepatchworks.com/product-documentation/virtual-environments/managing-virtual-environments-versions-and-flows/managing-virtual-environment-flow-deployments/disabling-or-enabling-a-process-flow-deployment-for-a-virtual-environment) the flow, allowing it to run according to defined triggers but without any virtual environment [replacements](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version/configuring-virtual-environment-replacements).
{% endhint %}

{% hint style="info" %}
All virtual environments with a deployed configuration version will be available for selection. If you don't see a virtual environment that you're expecting, [check that its configuration has been deployed](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-the-configuration-for-a-virtual-environment).
{% endhint %}
{% endstep %}

{% step %}
**Choose a flow version**

Click in the `flow version` field and select the required process flow version from the dropdown list - for example:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F2ulWcXs71LsEz1vhG5nh%2Fview%20deployments%204.png?alt=media&#x26;token=d188e53a-007a-4c90-8e5b-3f3a1529ebf2" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Over time, the number of flow versions displayed here will change. You can deploy any version (of any status), provided that the selected environment does not already contain a version of this process flow.
{% endhint %}
{% endstep %}

{% step %}
**Set a queue priority**

Each process flow has a `queue priority`, defined in [process flow settings](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-settings). This applies to the process flow as a whole - any version you choose to deploy inherits this setting. If required, you can override the priority here:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FvByQUBWlSdNjF4s7fOyq%2Fview%20deployments%205.png?alt=media&#x26;token=a7a378cb-4f24-4876-99a2-ca746d4e203c" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Changing the priority here means that the new priority is applied when this flow version runs in the given virtual environment UNLESS the virtual environment is configured with a queue priority override (in which case the override takes [precedence](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-a-single-process-flow-to-a-virtual-environment/understanding-queue-priority-in-virtual-environments)).
{% endhint %}
{% endstep %}

{% step %}
**Check the enabled/disabled status**

The default setting is to deploy and `enable` the flow, so it runs according to any defined trigger settings immediately (i.e. it's 'live'). If required, you toggle the `disable flow` toggle option to `on`, so it does not run automatically. For example:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Flmfzb1rjmHg92Xm0aEon%2Fview%20deployments%206a.png?alt=media&#x26;token=07345798-6d39-407a-bb0c-79f4474f0f87" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Start the deployment**

Click the `deploy` button to confirm your selections.&#x20;

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fz853SMz44q6GCU87uBX6%2Fview%20deployments%207.png?alt=media&#x26;token=eda6991f-e45e-489b-8b08-a66ad475b7c5" alt=""><figcaption></figcaption></figure>

This deployment is added to the list and can be [managed](https://doc.wearepatchworks.com/product-documentation/virtual-environments/managing-virtual-environments-versions-and-flows/managing-virtual-environment-flow-deployments) from here as needed.
{% endstep %}

{% step %}
**Confirm the deployment**

If any version of this process flow is found in your target environment (including `no environment)`, you are prompted to confirm that you want to replace the existing deployment:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F5xJW3v3LJiCk3LqWW5qt%2Fview%20deployments%208.png?alt=media&#x26;token=0a3e06c6-3871-4fb7-a56a-65c7d20c5ab3" alt="" width="390"><figcaption></figcaption></figure></div>

If you're satisfied that it's safe to proceed, confirm this action.&#x20;

{% hint style="info" %}
The deployment is added to the `view deployments` modal, where the associated ellipsis icon can be used to manage this deployment:

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpY58xeh9I5vsUYNauagE%2Fview%20deployments%209.png?alt=media\&token=f839a4ab-4296-42cd-a1c5-2ae81185b9e7)

From here, you can [edit](https://doc.wearepatchworks.com/product-documentation/virtual-environments/managing-virtual-environments-versions-and-flows/managing-virtual-environment-flow-deployments/updating-the-queue-priority-for-an-existing-flow-deployment), [disable](https://doc.wearepatchworks.com/product-documentation/process-flows/managing-process-flows/enabling-and-disabling-a-process-flow/enabling-and-disabling-a-process-flow-without-virtual-enviroments) or [delete](https://doc.wearepatchworks.com/product-documentation/virtual-environments/managing-virtual-environments-versions-and-flows/managing-virtual-environment-flow-deployments/deleting-a-process-flow-deployment-from-a-virtual-environment) the deployment.
{% endhint %}
{% endstep %}
{% endstepper %}
