# Updating a virtual environment version

## Introduction

Once a virtual environment version is deployed, it cannot be edited. Any updates to the current (i.e. `deployed`) configuration for a virtual environment must be made in a `draft` version, and then this version must be [deployed](https://doc.wearepatchworks.com/product-documentation/virtual-environments/managing-virtual-environments-versions-and-flows/managing-virtual-environment-configuration-versions/deleting-a-virtual-environment-version).

{% hint style="info" %}
If you're not familiar with the lifecycle of a virtual environment configuration version, please refer to [Understanding virtual environment versions](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version/understanding-virtual-environment-versions).
{% endhint %}

## The steps

{% stepper %}
{% step %}
**Access virtual environments**

[Log in to the dashboard](https://app.wearepatchworks.com/virtual-environments) and select `virtual environments` | `overview` from the left-hand navigation menu.
{% endstep %}

{% step %}
**Select the required virtual environment**

Click the name associated with the virtual environment that you want to access - 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%2F1V0ZG4LsOan2FkGwG06h%2Fupdate%20ve%20version%201.png?alt=media&#x26;token=a3843bff-f546-46e1-99c6-e360c05ada9b" alt="" width="375"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Access the DRAFT version**

If a `draft` version exists, access it now - 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%2FxIHP5wlfcsRbdgpaFTBp%2Fupdate%20ve%20version%202.png?alt=media&#x26;token=55d9dcc6-a070-4bbb-9d03-c6d362ebdc59" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="info" %}
If there isn't a current `draft` version, you can create a new one from scratch. Alternatively, you can use the `create draft from version` option to copy the setup for an existing `inactive` or `deployed` version to a `draft` version.
{% endhint %}
{% endstep %}

{% step %}
**Update the configuration**

Update [replacement components](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version/configuring-virtual-environment-replacements) as needed:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FXkBqL04YOWAAdPe9Tg8n%2Fupdate%20ve%20version%203.png?alt=media&#x26;token=98c7ae77-2df9-4e5d-9926-5b925101667f" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Don't forget that you can add notes for the current draft version (any notes added here stay with this version throughout its [lifecycle](https://doc.wearepatchworks.com/product-documentation/implementing-virtual-environments/configuring-a-virtual-environment-version/understanding-virtual-environment-versions#the-lifecycle-of-a-virtual-environment-version)):

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FcwSvTXALKrT0ntDviUU2%2Fupdate%20ve%20version%204.png?alt=media\&token=1fd71fc2-e35d-4fcd-a706-4a9d26544d4b)<br>
{% endhint %}
{% endstep %}

{% step %}
**Test the updated configuration**

Having completed required updates, you can test them against your master process flows. 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).
{% endstep %}

{% step %}
**Deploy the configuration**

Your updated configuration will be applied after it's [deployed](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-the-configuration-for-a-virtual-environment).
{% endstep %}
{% endstepper %}

## Creating a new virtual environment draft version

When a virtual environment is first [created](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/creating-a-virtual-environment), a `draft` version is added automatically, ready for you to update. Similarly, when a `draft` version is [deployed](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-the-configuration-for-a-virtual-environment), a new draft is created. With this in mind, a `draft` version will *typically* be available when you [access an existing virtual environment](https://doc.wearepatchworks.com/product-documentation/virtual-environments/managing-virtual-environments-versions-and-flows/managing-virtual-environments/accessing-an-existing-virtual-environment).

However, there may be times when you need to create a new `draft` version - for example, you may have lost track of what changes have been made in the current draft and want to start again from scratch, or you might want to start again based on the setup for an existing `deployed` or `inactive` version.

{% hint style="info" %}
If you're not familiar with the lifecycle of a virtual environment configuration version, please refer to [Understanding virtual environment versions](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version/understanding-virtual-environment-versions).
{% endhint %}

### Creating a new draft from scratch

{% stepper %}
{% step %}
**Access the relevant virtual environment**

If you're not already working in the required virtual environment, [log in to the dashboard](https://app.wearepatchworks.com/virtual-environments) and select `virtual environments` | `overview` from the left-hand navigation menu, then select the environment to update.
{% endstep %}

{% step %}
**Select the required virtual environment**

Click the name associated with the virtual environment that you want to access - 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%2FL5SbMikNubFLTgfgpMtj%2Fcreate%20draft%20from%20scratch%201.png?alt=media&#x26;token=d2e9fc08-698c-4f53-90b1-5e4521d57294" alt="" width="375"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Delete the existing DRAFT version**

Move down to the `configuration versions` panel and delete the existing `draft` version - for example:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FMyiuOCg7loIJvhYOLQwz%2Fcreate%20draft%20from%20scratch%202.png?alt=media&#x26;token=5f92e370-49fc-4b54-ac9e-67f8b8f9daa2" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
For more information about deleting virtual environment versions, please refer to [Deleting a virtual environment](https://doc.wearepatchworks.com/product-documentation/virtual-environments/managing-virtual-environments-versions-and-flows/managing-virtual-environments/deleting-a-virtual-environment).
{% endhint %}
{% endstep %}

{% step %}
**Create a new draft**

Click the `create` button:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FsIEDch4X3y6tzJ8aUzC9%2Fcreate%20draft%20from%20scratch%203.png?alt=media&#x26;token=d9c16270-9f44-4ac2-9189-1490ef10f5d7" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The `create` button is only displayed when no `draft` version exists
{% endhint %}
{% endstep %}

{% step %}
**Configure the draft version**

A new draft version is created, and you can [configure replacements](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version/configuring-virtual-environment-replacements) as needed:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FP2qtrsUMXTsA40gYS3eb%2Fcreate%20draft%20from%20scratch%204.png?alt=media&#x26;token=3d2e3ccd-48a3-4da0-9626-7083b9004121" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Deploy the configuration**

Your updated configuration will be applied after it's [deployed](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-the-configuration-for-a-virtual-environment).
{% endstep %}
{% endstepper %}

### Creating a new draft based on an existing version

If you want to use an existing `deployed` or `inactive` version as a starting point for editing, you can create a `draft` using the `create draft from version` option.

{% stepper %}
{% step %}
**Access the relevant virtual environment**

If you're not already working in the required virtual environment, [log in to the dashboard](https://app.wearepatchworks.com/virtual-environments) and select `virtual environments` | `overview` from the left-hand navigation menu, then select the environment to update.
{% endstep %}

{% step %}
**Select the required virtual environment**

Click the name associated with the virtual environment that you want to access - 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%2FL5SbMikNubFLTgfgpMtj%2Fcreate%20draft%20from%20scratch%201.png?alt=media&#x26;token=d2e9fc08-698c-4f53-90b1-5e4521d57294" alt="" width="375"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Access options for an existing inactive or deployed version**

Move down to the `configuration versions` panel and click the ellipsis icon associated with the `inactive` or `deployed` version that you want to use as the starting point for your `draft` - for example:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FmpwILZtRFIujABnM920D%2Fcopy%20draft%200.png?alt=media&#x26;token=90fa772b-3632-4c68-a802-a250bd68ac63" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Create draft from version**

Select the `create draft from version` option:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fjj48P7nJyvoQIqkaREmI%2Fcopy%20draft%201.png?alt=media&#x26;token=aac0dc25-4918-4811-8791-b25c1c79ffed" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If a `draft` version exists when this option is used, it gets overwritten with the configuration from the selected version - in this case, the version number is NOT incremented. If no `draft` version exists, a new one is created with the configuration from the selected version.  &#x20;
{% endhint %}
{% endstep %}

{% step %}
**Update draft version**

You can now access the draft version and [configure replacements](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version/configuring-virtual-environment-replacements) as needed.
{% endstep %}

{% step %}
**Deploy the configuration**

Your updated configuration will be applied after it's [deployed](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/deploying-the-configuration-for-a-virtual-environment)
{% endstep %}
{% endstepper %}
