# Working with field mappings

## Introduction

This page provides guidance on using the [map shape](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/map-shape) to configure field mappings between two [connections](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/connector-shape).&#x20;

## Configuring a new map shape

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fa3METrevVBTGlyTxbQ3u%2Fadd%20new%20mapping%20and%20auto%20generate%20map.gif?alt=media\&token=b613aa27-ddfe-4fa4-8822-36d62e44a929)

</details>

**Step 1**\
Click the **source** endpoint option: &#x20;

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F0uLp1aGoqqbXhXrRygp9%2Fmapping%20-%20source%20and%20destination%20-%20add%20source.png?alt=media&#x26;token=71e6db00-c462-4838-892e-0dce5838f675" alt="" width="563"><figcaption></figcaption></figure></div>

...**source** and **target** selection fields are displayed:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FeaAwukdTOP9yoxTs5wnE%2Fadd%20endpoints.png?alt=media&#x26;token=f26bcb32-4a90-4d5f-90e5-b9841d3c5172" alt="" width="563"><figcaption></figcaption></figure></div>

**Step 2**\
Use **source** and **target** selection fields to choose the required connector instance and associated endpoints to be mapped - for example: &#x20;

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F99pgatEvoLmmgyK2f9l4%2Fadd%20mapping%20target.png?alt=media&#x26;token=2bd5fc0a-77f4-4abf-8d38-578e9fc62d8c" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
Any instances defined for your company profile are available to select as the **source** or **target**. \
\
If you aren't using a connector to retrieve data (for example, you are sending in data via the Inbound API or a webhook), you won't select a **source** endpoint - instead, use the **override source format** dropdown field to select the format of your incoming data:\
![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FHvd3of0Mr9EDsrE8BGLi%2Foverride%20source%20format.png?alt=media\&token=922b4d68-cc19-4c0b-ae1f-5bdadf46d50e)
{% endhint %}

**Step 3**\
Click the **generate automatic mapping** button:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FdjrFAcjG2U8D4JAZtq9H%2Fgenerate%20auto%20mapping%20option.png?alt=media&#x26;token=4d3ab7f9-1e4f-43da-84c3-09b1be7c0efc" alt="" width="563"><figcaption></figcaption></figure></div>

...when prompted to confirm this operation, click **generate mapping**:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F6RfK6CGrL8i06ieB8Vwe%2Fgenerate%20auto%20mapping%20option%20-%20confirm.png?alt=media&#x26;token=be91815f-b2bb-4c1c-916d-f0e1ffe8ffeb" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="warning" %}
As we're configuring a new map shape, there's no danger that we would overwrite existing mappings. However, always use this option with caution if you're working with an existing map shape - any existing mapping rules are overwritten when you choose to generate automatic mappings.
{% endhint %}

{% hint style="info" %}
If you need to access the generate automatic option for an existing mapping shape, you need to click into the source and target details first.

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FoWrW1dvLzvnTHcsIc3xk%2Fauto%20generate%20mappings%20for%20existing%20shape.gif?alt=media\&token=00d0424a-bf7c-4b9c-93e1-09103b4c6d2b)

</details>
{% endhint %}

**Step 4**\
Patchworks attempts to apply mappings between your given source and target automatically. A mapping rule is added for each **source** data field and, where possible, a matched **target** field - 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%2FfvvlVYpYGR2gHLZmHgwZ%2Fgenerate%20auto%20mapping%20option%20-%20complete.png?alt=media&#x26;token=8ff2ae5f-c463-432c-8e33-5252ef6f2818" alt="" width="563"><figcaption></figcaption></figure></div>

From here you can refine mappings as needed. You can:

* [Add a new mapping rule](#adding-a-new-mapping-rule)
* [Change display names and/or fields in an existing rule](#updating-an-existing-mapping-rule)
* [Add a target mapping for a partial mapping rule](#adding-a-target-mapping-for-a-partial-mapping-rule)
* [Map a source field to multiple targets](#mapping-a-source-field-to-multiple-targets)
* [Map multiple source fields to a single target](#mapping-multiple-source-fields-to-a-single-target)
* [Add transformations for a mapping rule](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/map-shape/working-with-field-transformations)
* [Delete a mapping rule](#deleting-a-mapping-rule)

**Step 5**

Toggle `wrap input payload` and `wrap output payload` options ON/OFF as required.

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F69RiEKZZw8JU6e0MoOdG%2Fwrap%20payload%201.png?alt=media&#x26;token=34701bb5-f917-4685-97df-ace1edd1c407" alt="" width="563"><figcaption></figcaption></figure></div>

Where:

* `wrap input payload` ON. Wraps the incoming payload in an array `[ ]` ONLY for processing within the map shape.
* `wrap output payload` ON. Wraps the outgoing payload in an array `[ ]` ONLY for onward processing.

Click options below for payload examples showing how these options work in practice:

<details>

<summary><strong>Wrap input payload: ON / Wrap output payload ON</strong></summary>

*Incoming payload*

{% code lineNumbers="true" %}

```json
{"colour_1":"red",
"colour_2":"blue",
"colour_3":"green"}
```

{% endcode %}

*Payload used for map shape processing*

{% code lineNumbers="true" %}

```json
[{"colour_1":"red",
"colour_2":"blue",
"colour_3":"green"}]
```

{% endcode %}

*Output payload for onward processing*

{% code lineNumbers="true" %}

```json
[{"colour_1":"red",
"colour_2":"blue",
"colour_3":"green"}]
```

{% endcode %}

</details>

<details>

<summary><strong>Wrap input payload: ON / Wrap output payload OFF</strong></summary>

*Incoming payload*

{% code lineNumbers="true" %}

```json
{"colour_1":"red",
"colour_2":"blue",
"colour_3":"green"}
```

{% endcode %}

*Payload used for map shape processing*

{% code lineNumbers="true" %}

```json
[{"colour_1":"red",
"colour_2":"blue",
"colour_3":"green"}]
```

{% endcode %}

*Output payload for onward processing*

{% code lineNumbers="true" %}

```json
{"colour_1":"red",
"colour_2":"blue",
"colour_3":"green"}
```

{% endcode %}

</details>

<details>

<summary><strong>Wrap input payload: OFF / Wrap output payload ON</strong></summary>

*Incoming payload*

{% code lineNumbers="true" %}

```json
{"colour_1":"red",
"colour_2":"blue",
"colour_3":"green"}
```

{% endcode %}

*Payload used for map shape processing*

{% code lineNumbers="true" %}

```json
{"colour_1":"red",
"colour_2":"blue",
"colour_3":"green"}
```

{% endcode %}

*Output payload for onward processing*

{% code lineNumbers="true" %}

```json
[{"colour_1":"red",
"colour_2":"blue",
"colour_3":"green"}]
```

{% endcode %}

</details>

<details>

<summary><strong>Wrap input payload: OFF / Wrap output payload OFF</strong></summary>

*Incoming payload*

{% code lineNumbers="true" %}

```json
{"colour_1":"red",
"colour_2":"blue",
"colour_3":"green"}
```

{% endcode %}

*Payload used for map shape processing*

{% code lineNumbers="true" %}

```json
{"colour_1":"red",
"colour_2":"blue",
"colour_3":"green"}
```

{% endcode %}

*Output payload for onward processing*

{% code lineNumbers="true" %}

```json
{"colour_1":"red",
"colour_2":"blue",
"colour_3":"green"}
```

{% endcode %}

</details>

**Step 6**\
Save changes.

## Adding a new mapping rule

You can add as many new mapping rules as required to map data between source and target connections. &#x20;

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FgzfoKWmG2q5SANb82S8u%2Fsteps.svg?alt=media&#x26;token=2259f301-304d-43da-86c0-4e810b9894f4" alt="" data-size="line"> The steps</summary>

**Step 1**\
Click the **add mapping rule** button:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F0e17cTjqW5nTlPfXmePI%2Fadd%20mapping%20row%201.png?alt=media&#x26;token=75dc9680-9f49-4a67-90f7-3c3e7e3eade8" alt="" data-size="original">

...a new mapping rule is added:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FSf57ECqYUtSqmvmrIYcb%2Fadd%20mapping%20row%202.png?alt=media&#x26;token=a2fa5523-db90-4177-9138-b1b01373e21e" alt="" data-size="original">

**Step 2**\
Click the source element of the new mapping rule:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FeCmUdUPKg8vWDi49p3Tx%2Fadd%20rule%202.png?alt=media&#x26;token=53b932d2-9938-4e5b-aa98-ec32011e7950" alt="" data-size="original">

...source details are opened in edit mode:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F3BgK3LLn1mg24TWasq0z%2Fadd%20mapping%20row%203.png?alt=media&#x26;token=061eca20-74fd-44e5-945d-2e8a61807635" alt="" data-size="original">

**Step 3**\
Move down and select the required field from the payload associated with your source connection - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FszryIpOWOOZGTjT7ejOM%2Fadd%20rule%203a.png?alt=media&#x26;token=b09f8a33-1ca3-44ec-ad0a-dab418518fdc" alt="" data-size="original">

**Step 4**\
Set the display name as required - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fhnx2Qi8u06vxd3ilmBPW%2Fadd%20rule%204.png?alt=media&#x26;token=72ff1e3a-89d8-4a2f-aad4-eb208ac460d1" alt="" data-size="original">

**Step 5**\
Accept your changes:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F5OLfOKexKyGnKDDhaMSG%2Fadd%20rule%205a1.png?alt=media&#x26;token=4d95971e-86d3-4bb4-9669-f77ace2683e9" alt="" data-size="original">

...the mapping rule is updated with a source field:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FRUBOKu9NEQxDuiC9QNII%2Fadd%20rule%205a.png?alt=media&#x26;token=c3add7f1-2106-43ef-a991-8a313ea9f6d4" alt="" data-size="original">

**Step 6**\
Click the target element of the new mapping rule:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FzJYwqalpwjS8IoWIFZTV%2Fadd%20mapping%20row%204.png?alt=media&#x26;token=5ea71f4b-7952-4ea5-bc5f-117b831bcfc6" alt="" data-size="original">

...target details are opened in edit mode:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FnDBdTeEw1HdXFcV06ySI%2Fadd%20mapping%20row%205.png?alt=media&#x26;token=6ab6d8cc-ebb6-4149-9c3e-9ec3a5923a8d" alt="" data-size="original">

**Step 7**\
Move down and select the required field from the payload associated with your target connection - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FiIIuOKjrvT7I5pWgdb6O%2Fadd%20rule%205c.png?alt=media&#x26;token=381d72af-beec-4e94-bd53-5d1182bc74d9" alt="" data-size="original">

**Step 8**\
Set the display name as required - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FhL56V9lsIsHnTHNK8MUV%2Fadd%20rule%205d.png?alt=media&#x26;token=a36f50ec-8c23-4d2a-a6cf-d3c67141e55b" alt="" data-size="original">

**Step 9**\
If your target system will not accept null and/or empty values received for this field, move down to the remove field conditions field and select the required condition(s):

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FNKiMRg5aJoHz7gP8Swa5%2Fadd%20mapping%20row%206.png?alt=media\&token=bc6aaf8d-9380-4498-8842-72979d59578e)

You can apply one or both conditions.

**Step 10**\
Accept your changes. The mapping rule is updated with a target field:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpR9tIPel1Do9w705QskC%2Fadd%20rule%205f.png?alt=media&#x26;token=8ee67300-1605-4bcb-bcd6-2cb8bea7759a" alt="" data-size="original">

**Step 11**\
You can now add more rows as required, but it's a good idea to save changes frequently:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fl95v8W8dauVvvniwXx4W%2Fadd%20rule%205g.png?alt=media&#x26;token=8cc48c3a-9b48-4fdc-996d-bfd552803085" alt="" data-size="original">

**If you exit from the mapping editor without saving changes, any updates made to mapping rules since the last save will be lost.**

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FglaIaNSZh6nQYBFHilNc%2Fdemo%20add%20new%20map%20rule.gif?alt=media\&token=b2078130-c2a6-4cc9-8f0f-1b3b7522ac7a)

</details>

## Specifying a mapping field manually

There may be times where you don't want to (or can't) use the payload fields dropdown select a field from your source/target data schema. In this case, you simply select the **manual input** field and enter the full schema path for the required field.

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FgzfoKWmG2q5SANb82S8u%2Fsteps.svg?alt=media&#x26;token=2259f301-304d-43da-86c0-4e810b9894f4" alt="" data-size="line"> The steps</summary>

**Step 1**\
Click the **source** or **target** element of the mapping rule that you want to update:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FFuly6nISs0SyEsUB2gVB%2Fmanual%20map%201.png?alt=media&#x26;token=28bc3a70-a52e-43ea-a8b5-a448d491a716" alt="" data-size="original">

**Step 2**\
Once the rule is opened in edit mode, select the **manual input** checkbox - for example:&#x20;

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FToHqC9Dpr73Rdwy47Bew%2Fmanual%20map%202.png?alt=media&#x26;token=a8198c10-0553-443d-8ba2-029a1d571788" alt="" data-size="original">

**Step 3**\
Click the **accept** button to confirm your change:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F8vy0NiHMu7Q02T4j4snd%2Fmanual%20map%203.png?alt=media&#x26;token=2ba570e3-b8e9-4be5-9149-5cf0b73ea13e" alt="" data-size="original">

**Step 4**\
Accept changes.

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FVCX8y3UmNr1TgXifoT9H%2Fadd%20manual%20mapping%20rule.gif?alt=media\&token=c16522ba-85cf-490b-9647-663f7b13c4be)

</details>

## Changing display names or fields in an existing rule

You can change the display name and/or the field associated with the **source** or **target** for any mapping rule. &#x20;

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FgzfoKWmG2q5SANb82S8u%2Fsteps.svg?alt=media&#x26;token=2259f301-304d-43da-86c0-4e810b9894f4" alt="" data-size="line"> The steps</summary>

**Step 1**\
Click either the **source** or **target** element of the mapping rule (it doesn't matter which - both sides of the mapping will be available to edit):

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FYByFhMUCXML80ig2Asww%2Fchange%20name%201.png?alt=media&#x26;token=9e73f931-d29f-4c3f-9009-d700e9ae5bf3" alt="" data-size="original">

**Step 2**\
Update the existing **display** name as required.

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FyAZLdzd4ihUTZ9h8fiXt%2Fchange%20name%202.png?alt=media&#x26;token=86a9bd21-153c-4026-9bca-6f04cd1afb1a" alt="" data-size="original">

**Step 3**\
Click the **accept** button to confirm your change:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FTwg2VW30kyiiEAzGFR7L%2Fchange%20name%203.png?alt=media&#x26;token=55eedf97-f40d-4c0f-8d4e-9a540bcb847e" alt="" data-size="original">

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FIC4thZtGM2aqtr3jfLtg%2Fchange%20map%20display%20names.gif?alt=media\&token=dac6af2a-68b7-4d1b-b1dc-7c42c268c3ed)

</details>

## Adding a target mapping for a partial mapping rule

If you've used the [automatically generate map](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/map-shape/..#auto-generating-mappings-between-connections) option to generate an initial set of mappings, you may find that some source fields could not be auto-mapped. In these cases, a mapping rule is added for each un-mapped source field, so you can either add the required destination or [delete the rule](#deleting-a-mapping-rule).

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FgzfoKWmG2q5SANb82S8u%2Fsteps.svg?alt=media&#x26;token=2259f301-304d-43da-86c0-4e810b9894f4" alt="" data-size="line"> The steps</summary>

**Step 1**\
Click the **source** element of the mapping rule to open the rule in edit mode - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FEs5K1lb14oNQat7WxYdP%2Fadd%20target%200.png?alt=media&#x26;token=bb3c0ca9-22d5-4e98-af95-714847bc8082" alt="" data-size="original">

**Step 2**\
Click the **add destination field** button:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F8q7v9leNF7mFjRiza7h3%2Fadd%20target%201.png?alt=media&#x26;token=e290dd73-de0b-4f43-a774-c399ad80bf24" alt="" data-size="original">

**Step 3**\
Move down and select the required field from the payload associated with your source connection - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F6FWBKnRb5rd5H0a1l1ky%2Fadd%20target%203.png?alt=media&#x26;token=80aee3c8-5d15-4bc1-998c-f7fb5e0f0d67" alt="" data-size="original">

**Step 4**\
Set the display name as required - for example:

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F5V2jT1zYeyWBmHMPc2R4%2Fadd%20target%203a.png?alt=media\&token=d01e4101-b7e8-486e-8bd9-5f0103df3801)

**Step 5**\
If your target system will not accept null and/or empty values received for this field, move down to the remove field conditions field and select the required condition(s):

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FNKiMRg5aJoHz7gP8Swa5%2Fadd%20mapping%20row%206.png?alt=media\&token=bc6aaf8d-9380-4498-8842-72979d59578e)

You can apply one or both conditions.

**Step 6**\
Accept your changes.

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FZfGMaOIZypFTkdVOMuEZ%2Fadd%20target%20mappinhg%20for%20partial%20rule.gif?alt=media\&token=7f4778fd-8210-4232-87e5-359403f50fbc)

</details>

## Mapping a source field to multiple targets

If required, you can map a source field to multiple target fields - for example, you might need to send a customer order number into two (or more) target fields.&#x20;

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FgzfoKWmG2q5SANb82S8u%2Fsteps.svg?alt=media&#x26;token=2259f301-304d-43da-86c0-4e810b9894f4" alt="" data-size="line"> The steps</summary>

**Step 1**\
Click the target element of the mapping rule that you wish to update with an additional target field - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F4id7ayEqtGvIZuZ90toc%2Fadd%20multi%201.png?alt=media&#x26;token=26be59f4-4bb9-4e3c-84ec-fa5e95a94837" alt="" data-size="original">

...the mapping rule opens with the current target field in edit mode - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FZwD1ZS2ap1sq0iTYeV32%2Fadd%20multi%201a.png?alt=media&#x26;token=c8f07b9a-1852-4244-9a55-e20690098b3d" alt="" data-size="original">

**Step 2**\
Click the **add destination field** button:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fh0Cz0UK8qpcftVWqcaxc%2Fadd%20multi%202.png?alt=media&#x26;token=3452820a-6bad-407b-84ac-dd8bc37f371c" alt="" data-size="original">

...a new target field placeholder is added beneath the existing one - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FsqN68c9GMpScvSe2uLbT%2Fadd%20multi%202a.png?alt=media&#x26;token=b9f52f05-8cd1-4ec8-a7c4-7c870bb6429b" alt="" data-size="original">

**Step 3**\
Click in this field to activate settings fields below - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F69UODOL4ONK0BjNnoS2x%2Fadd%20multi%203.png?alt=media&#x26;token=403b5e81-d258-4893-8465-432b11636248" alt="" data-size="original">

**Step 4**\
Move down and select the required field from the payload associated with your target connection - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FqmP0qhrynrPZmz41DOLb%2Fadd%20multi%204.png?alt=media&#x26;token=a90ec9d4-c1f6-455e-baca-cce319e382fc" alt="" data-size="original">

**Step 5**\
Set the display name as required - for example:

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F6jj2nkMuVIgiLVIMKByi%2Fadd%20multi%205.png?alt=media\&token=2fcb0d1b-262b-4f0f-8020-f01d15cfb604)

**Step 6**\
If your target system will not accept null and/or empty values received for this field, move down to the remove field conditions field and select the required condition(s):

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FNKiMRg5aJoHz7gP8Swa5%2Fadd%20mapping%20row%206.png?alt=media\&token=bc6aaf8d-9380-4498-8842-72979d59578e)

You can apply one or both conditions.

**Step 7**\
Accept your changes.

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FlWWuTSXnvQjJqMVc7wSN%2Fadd%20multi%20target%20fields.gif?alt=media\&token=ac560dd2-2a08-49c2-82af-f47f376c5c8b)

</details>

## Mapping multiple source fields to a single target

Sometimes it can be useful to map multiple source fields to a single target field. For example, you might have a target connection which expects a single field for 'full name', but a source connection with one field for 'first name' and another field for 'surname'.&#x20;

In this case, you would define mappings for the required source and target fields, then [add a transform function](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/map-shape/working-with-field-transformations) to [concatenate](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/working-with-field-transformations/available-transform-functions#text-string) the two source fields.

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FgzfoKWmG2q5SANb82S8u%2Fsteps.svg?alt=media&#x26;token=2259f301-304d-43da-86c0-4e810b9894f4" alt="" data-size="line"> The steps</summary>

**Step 1**\
Click the source element of the mapping rule that you wish to update with an additional source field - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FgjFo5bdu3IneAlQtB3lf%2Fmulti%20to%20one%201.png?alt=media&#x26;token=56567d7d-1a56-4089-80ec-05e4f2c4f51b" alt="" data-size="original">

...the mapping rule opens with the current source field in edit mode - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FPXZxQWtp3pSWXq4OodGN%2Fmulti%20to%20one%202.png?alt=media&#x26;token=428b223d-1777-4f47-be35-4a558e953268" alt="" data-size="original">

**Step 2**\
Click the **add source field** button:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FvoKgFsyOsc4mG917cMtx%2Fmulti%20to%20one%203.png?alt=media&#x26;token=86b0a418-01b1-4b6a-a30f-c6db4ef54d64" alt="" data-size="original">

...a new source field placeholder is added beneath the existing one - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Ft63OHwByxbjb23TjcJWT%2Fmulti%20to%20one%203a.png?alt=media&#x26;token=e6d468c6-359c-49b6-a94a-cc2f7cc9d62e" alt="" data-size="original">

**Step 3**\
Click in this field to activate settings fields below - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F61F5do99ABlTKiQy94Fj%2Fmulti%20to%20one%204.png?alt=media&#x26;token=9e7e2f18-eee9-4d27-9802-65752fc50eba" alt="" data-size="original">

**Step 4**\
Move down and select the required field from the payload associated with your source connection - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FWkXVjZwF0X2bJAZ0ZOH7%2Fmulti%20to%20one%205.png?alt=media&#x26;token=5ffb36bf-5ddc-4ec0-bec8-393fa061cdb1" alt="" data-size="original">

**Step 5**\
Set the display name as required - for example:

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FoZu04ssKWHgxxX5SaiqJ%2Fmulti%20to%20one%205a.png?alt=media\&token=91e6691f-e256-4ba5-9462-1a76235a9652)

**Step 6**\
Accept your changes. The mapping rule is now displayed with two source fields - for example:

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F6c47xZ2aRTuDIeznWhqf%2Fmulti%20to%20one%206.png?alt=media\&token=3b932db4-6c73-47dd-a1e1-8c8a765ca89e)

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fn7X0gddeY3oxgxNQ9kjo%2Fdemo%20multi%20to%20one.gif?alt=media\&token=cb4962d1-8340-4a74-a5e9-74f0c8ec0e2e)

</details>

## Deleting a mapping rule

When you choose to delete a mapping rule, it's removed from the list immediately. However, the deletion is not permanent until you choose to save the mapping shape.

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FgzfoKWmG2q5SANb82S8u%2Fsteps.svg?alt=media&#x26;token=2259f301-304d-43da-86c0-4e810b9894f4" alt="" data-size="line"> The steps</summary>

**Step 1**\
Click the source or target element associated with the rule that you want to delete - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FO1vtht0MaJl2UPe1shKG%2Fdelete%20rule%201.png?alt=media&#x26;token=22ba5458-f1b8-43b3-9a7d-cb8fc5d380a6" alt="" data-size="original">

...the mapping rule opens in edit mode - for example:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fp1WTWbejLP0gN4mkHPpu%2Fdelete%20rule%201a.png?alt=media&#x26;token=f58e6105-8063-4de8-a24f-b02f2211b8fe" alt="" data-size="original">

**Step 2**\
Click the **delete mapping row** button to remove the rule immediately:

<img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FflCa4lP0wCteTSyID5GR%2Fdelete%20rule%202.png?alt=media&#x26;token=2ae83e7d-a655-4d7a-a2d5-290e4d89860d" alt="" data-size="original">

**Step 3**\
Save the mapping shape.

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpLMO12yvTCxi9PorCt53%2Ficons8-film.svg?alt=media&#x26;token=e59864bc-2d97-4f98-966c-a083c18e60db" alt="" data-size="line"> Show me</summary>

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpkFUcTFXfm6purF7vXMn%2Fdemo%20delete%20mapping%20rule.gif?alt=media\&token=3699ff53-61e3-48fb-b040-db1447a5e049)

</details>
