# Working with field transformations

## Introduction

**Field transformations** can be defined to change the value of a data field pulled from a source system before it is sent to its target. A **transformation** is comprised of one or more [functions](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/map-shape/working-with-field-transformations/available-transform-functions).

This page explains how to [add a new transformation](#adding-a-new-transformation) for a field mapping, and [how to remove functions and transformations](#deleting-an-existing-function-or-transformation).&#x20;

{% hint style="info" %}
For a summary of available transform functions please see the [Field mapping transformation function reference](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/map-shape/working-with-field-transformations/available-transform-functions) section.
{% endhint %}

{% hint style="info" %}
For information about adding a field transformation using a cross-reference lookup table, please see our [cross-reference lookups](https://doc.wearepatchworks.com/product-documentation/process-flows/cross-reference-lookups) section.
{% endhint %}

## Adding a new transformation

To add a new transformation for a field mapping, you start by adding a new transformation and then build the required functions. To do this, follow the steps below:

**Step 1**\
Access the required process flow and then edit the map shape to be updated with a transform:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fr20Cp7LXBbJ5pZ0o3fey%2Fadd%20transform%201.png?alt=media&#x26;token=f32c90b8-fa62-4852-9afa-9b99216fb16f" alt="" width="317"><figcaption></figcaption></figure></div>

**Step 2**\
Find the mapping that you want to update, then click the **transform** icon (between source and target elements). For our example, we're going to add a prefix to the 'id' field:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FYjXnonSuY5pvf8tHm8Cv%2Fgeneric%20transform%201.png?alt=media&#x26;token=ea8148a6-a466-4d6d-b72d-946bd7b4c59e" alt="" width="563"><figcaption></figcaption></figure></div>

**Step 3**\
Click the **add transform** button:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F5vFLGALVo0OJUJ33ybxZ%2Fgeneric%20transform%202.png?alt=media&#x26;token=dd9b341c-3144-4a43-82a9-77f4d64a84e7" alt="" width="563"><figcaption></figcaption></figure></div>

**Step 4**\
Use the **select a function** field to choose the type of function that you need to use (functions are organised by type):

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FMVNzzzdIVWvZJlHuujH0%2Fgeneric%20transform%203.png?alt=media&#x26;token=63374cf8-f52e-4dc9-a799-5ca8b983709c" alt="" width="563"><figcaption></figcaption></figure></div>

**Step 5**\
Depending on the type of function you select, additional fields are displayed for you to complete. Update these as required - for our example we're adding some text to be added as a prefix:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FLp4BhxTrVX1AcQRB8v8L%2Fgeneric%20transform%204.png?alt=media&#x26;token=bd4ffd8a-c730-417a-9b2a-9e7003b57eed" alt="" width="563"><figcaption></figcaption></figure></div>

**Step 6**\
Now we need to confirm which source field this transform field should be applied for - click the **add field** button:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FMSlbywiKL2z79jeIhgez%2Fgeneric%20transform%205.png?alt=media&#x26;token=e206d010-d2aa-4a5b-9032-197ae7ba79f3" alt="" width="563"><figcaption></figcaption></figure></div>

**Step 7**\
Select the required field:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F9RSUXSUVtY4HxKoHFTXd%2Fgeneric%20transform%206.png?alt=media&#x26;token=2b5267fe-ae1e-42dd-8076-715faf93fbca" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="info" %}
In straightforward scenarios, this will typically be the same source field as defined for the mapping row. However, more complex scenarios may prompt multiple options here - for example, if you apply multiple transforms to the same mapping.
{% endhint %}

**Step 8**\
Accept your changes.

**Step 9**\
Add more fields if necessary.

**Step 10**\
When you're satisfied that all required fields have been added, accept changes and then save the shape settings.


---

# 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/process-flows/building-process-flows/process-flow-shapes/standard-shapes/map-shape/working-with-field-transformations.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.
