# Replacement instances

## Introduction

Having [chosen to configure instance replacements for a virtual environment](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version/configuring-virtual-environment-replacements/..#configuring-replacements-for-a-virtual-environment-version), a new replacement rule is displayed, ready for you to configure:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FtOlPrpYYVMoe5JZ264qk%2Freplace%20instance%201a.png?alt=media&#x26;token=febdfdf8-4083-47a3-bf57-a52382e75ca0" alt=""><figcaption></figcaption></figure>

Having defined the first rule, you can add more - you must create one replacement rule for every instance that you need to replace in every process flow that will run in this environment.&#x20;

## Defining replacement rules for an instance

{% stepper %}
{% step %}
**Select the required connector**

Use the `connector` dropdown list and choose a connector that's included in any process flows that you'll be running in this virtual environment:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FmJK1ym7mMGjSvoEjMSEN%2Freplace%20instance%201b.png?alt=media&#x26;token=27999e75-2eff-4f3f-982a-20ec38995b65" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
As you work through your replacement configuration, it's helpful to view related ['master' process flows](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/creating-a-master-process-flow) in another browser tab. You can duplicate a Patchworks browser tab and navigate to a different page whenever needed.
{% endhint %}
{% endstep %}

{% step %}
**Select the required ORIGINAL connector instance**

Use the `original` dropdown list to select an instance in a 'master' process flow that must be replaced when this process flow runs in the given virtual environment - for example:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FAAxMANVA3PDQjpbW9qBn%2Freplace%20instance%202a.png?alt=media&#x26;token=f1b3a6fb-6c99-4b2c-b744-32c712c12519" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Select the required REPLACEMENT connector instance**

Use the `replacement` dropdown list to select the replacement instance that must be used when this process flow runs in the given virtual environment - for example:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FfErVhkLs3lXGZ5CUljDA%2Freplace%20instance%203a.png?alt=media&#x26;token=10faed1d-51c3-45b7-9d27-13279c87f218" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Confirm your selections**

Click the `create` button (associated with this replacement rule) to confirm your selections:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FPBRVrrxPKZdgEdjnUelo%2Freplace%20instance%204.png?alt=media&#x26;token=112bab7c-4bc3-41ae-b042-8d4b6c2f0249" alt=""><figcaption></figcaption></figure>

The rule is added:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F5UJEfP3CBSfH24Bv2Gay%2Freplace%20instance%205.png?alt=media&#x26;token=1f0fc306-c2fd-46f4-bba5-c81a369e6d23" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Once a rule is confirmed, it can't be edited. If you need to change a replacement rule, use the 'trash' icon to remove it and add a new one.
{% endhint %}
{% endstep %}

{% step %}
**Add more replacement rules for connector instances**

To add another replacement rule for a connector instance, click the top-right `create` button:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FYhFjB9hdWHixEhqxL4VJ%2Freplace%20instance%205a.png?alt=media&#x26;token=460c95ee-3238-4691-90ae-2eea2f8255d9" alt=""><figcaption></figcaption></figure>

Update the new rule as required, then click the associated `create` button to confirm your selections:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F9TUeNg6UCCo2OD0dd4pH%2Freplace%20instance%206.png?alt=media&#x26;token=91f57549-4d3e-4d44-b775-72ab16f2f2c0" alt=""><figcaption></figcaption></figure>

Repeat as many times as needed to define all required instance replacements for all process flows that will be running in this virtual environment.

{% hint style="info" %}
If you don't want to define ALL instance replacements now, that's OK. For example, you might choose to add the minimum number of replacements needed for [testing](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/testing-a-process-flow-against-a-virtual-environment), then define remaining rules (in a [new draft](https://doc.wearepatchworks.com/product-documentation/virtual-environments/implementing-virtual-environments/configuring-a-virtual-environment-version/understanding-virtual-environment-versions)) later, after initial testing is complete.
{% endhint %}
{% endstep %}
{% endstepper %}
