# Understanding flow versioning for virtual environments

## Introduction

If you've been building and running process flows before the introduction of virtual environments, you'll be used to the ['normal' rules around process flow versioning](/product-documentation/process-flows/building-process-flows/process-flow-versioning.md), where (in a nutshell) a process flow can have one `deployed` version, one `draft` version, and multiple `inactive` versions .&#x20;

With *virtual environments*, the same statuses are used, but we need to think differently about how they are applied. Each version of a process flow moves through its own status cycle, and different versions can be deployed to different virtual environments. So instead of asking (for example):

&#x20;*Is this process flow deployed?* &#x20;

...ask instead:

*How many deployed versions does this process flow have?*

## How it works

With virtual environments, statuses are tied to flow versions, rather than the process flow as a whole. A process flow version can move through three statuses:

* Draft
* Deployed
* Inactive

When a process flow is created, a `draft` version is generated automatically. This version can then become `deployed` (whereupon a new `draft` version is generated) and subsequently `inactive` when the current `draft` is deployed. So, each new `draft` is a new flow version that moves through its own lifecycle, as illustrated below:

<figure><img src="/files/03sDlhxrAbh1V63smMMF" alt=""><figcaption></figcaption></figure>

Flow version rules are detailed [below](#versioning-rules-for-virtual-environments), but in essence:

* A process flow will only ever have ONE `draft` version.
* Only ONE version of a process flow can be deployed to a given virtual environment.
* Multiple versions of the same process flow can be deployed to different virtual environments.
* A flow version can be [deployed](/product-documentation/virtual-environments/implementing-virtual-environments/deploying-a-single-process-flow-to-a-virtual-environment.md) to a single virtual environment, to multiple virtual environments, or to no virtual environment.

## Deploying flow versions to virtual environments

You can deploy any existing `draft` or `inactive` version of a process flow to any active virtual environment, provided there's no existing version of that flow in the selected virtual environment.

When deploying to multiple virtual environments, you would typically deploy the same version (so all virtual environments include the same flow setup). However, it is possible to deploy different versions to different environments - in this case, you would see multiple `deployed` versions of the process flow (in [process flow settings](/product-documentation/process-flows/building-process-flows/process-flow-settings.md)) - for example:

<figure><img src="/files/fR7ogJR3Uh84ev93RHl4" alt=""><figcaption></figcaption></figure>

Let's break this down with an example, where we're deploying to two virtual environments (*Virtual Environment A*) and (*Virtual Environment B*):

<table><thead><tr><th width="235.1484375">Action</th><th>DRAFT v#</th><th>DEPLOYED v#</th><th>INACTIVE v#</th></tr></thead><tbody><tr><td>User creates process flow</td><td><a data-footnote-ref href="#user-content-fn-1">1</a></td><td> -</td><td>-</td></tr><tr><td>User deploys <code>draft</code> version     <code>#1</code> without a virtual environment.   </td><td><a data-footnote-ref href="#user-content-fn-2">2</a></td><td>1</td><td>-</td></tr><tr><td>User disables version <code>#1</code>  </td><td>2</td><td>-</td><td><a data-footnote-ref href="#user-content-fn-3">1</a></td></tr><tr><td>User deploys version <code>#2</code> to <em>Virtual Environment A</em></td><td><a data-footnote-ref href="#user-content-fn-4">3</a></td><td>2</td><td>1</td></tr><tr><td>User deploys version <code>#3</code> to <em>Virtual Environment B</em></td><td><a data-footnote-ref href="#user-content-fn-4">4</a></td><td>2 and 3</td><td>1</td></tr><tr><td>User un-deploys (i.e. deletes) version <code>#2</code>  from <em>Virtual Environment A</em> and version <code>#3</code> from <em>Virtual Environment B</em></td><td>4</td><td>-</td><td>1, 2, and 3</td></tr></tbody></table>

## Flow versioning rules for virtual environments

The following rules apply when working with process flow versions in virtual environments:

<table data-full-width="true"><thead><tr><th width="139.38671875">Version Status</th><th width="134.26171875">Can be edited?</th><th>Generated when...</th><th>Multiple allowed per flow?</th><th>Allowed actions</th></tr></thead><tbody><tr><td>Draft</td><td>Yes</td><td><ul><li>A new process flow is created (a <code>draft</code> version is generated automatically).</li><li>An existing <code>draft</code> version is deployed (the version number associated with the existing <code>draft</code> is incremented for the new one).</li><li>A user chooses to copy an existing <code>deployed</code> or <code>inactive</code> version to <code>draft</code> (content in the existing <code>draft</code> is overwritten but the version number is NOT incremented).</li></ul></td><td>No. A process flow will only ever have one version set to a <code>draft</code> status.</td><td><ul><li>Deploy <br>(<code>deployed</code> status)</li></ul></td></tr><tr><td>Deployed</td><td>No</td><td><ul><li>A user chooses to deploy a flow version. </li></ul></td><td><p>Yes. If <em>different</em> process flow versions are deployed to different virtual environments then multiple <code>deployed</code> versions will be present.</p><p></p><p>The number of deployed versions allowed is <em>x</em>+1, where <code>x</code> is your number of virtual environments and <code>1</code> is a deployment to no environment).<br><br>Alternatively - if the <em>same</em> flow version is deployed to all virtual environments, you'll only have one deployed version. </p></td><td><ul><li>Disable <br>(<code>inactive</code> status)</li><li>Delete  <br>(<code>inactive</code> status)</li><li>Copy to draft (overwrite existing <code>draft</code> version, no change to <code>deployed</code> version)</li></ul></td></tr><tr><td>Inactive</td><td>No</td><td><ul><li>A user disables ALL deployments of this version.</li><li>A user deletes deployments of this version from ALL virtual environments.</li></ul></td><td><p>Yes. Each time a flow version is un-deployed, it's set to an <code>inactive</code> status. This status remains unless:<br></p><ul><li>The same version is deployed again (in which case it becomes <code>deployed</code>) </li><li>The version is deleted. </li></ul></td><td><ul><li>Deploy <br>(<code>deployed</code> status)</li><li>Copy to draft (overwrite existing <code>draft</code> version, no change to <code>inactive</code> version)</li><li>Delete (version removed entirely)</li></ul></td></tr></tbody></table>

[^1]: Initial draft version is auto-generated when a process flow is created.

[^2]: When a draft version is deployed for the first time, a new `draft` is auto-generated from the previous one.

[^3]: The previously deployed version becomes inactive.

[^4]: When a `draft` is deployed for the first time, a new `draft` is auto-generated from the previous one.


---

# 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/virtual-environments/implementing-virtual-environments/deploying-a-single-process-flow-to-a-virtual-environment/understanding-flow-versioning-for-virtual-environments.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.
