# Field transformations (services)

## Introduction

**Field transformations** can be defined to change the value of data pulled from a source system before it is pushed to a destination system. A **transformation** is comprised of one or more **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;

## 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 service ](/product-documentation/patchworks-services/working-with-services/accessing-services.md)and select the **mappings** tab:

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

**Step 2**\
The **field mapping** page is displayed with mappings organised in logical categories, based on the **destination** connector:

<figure><img src="/files/04tXsKILjbaBautOz57I" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If a transformation has been applied to a field mapping already, it is displayed with a transformation icon:\ <img src="/files/elycCam3RetJPC8ij1Bo" alt="" data-size="original">&#x20;
{% endhint %}

**Step 3**\
Find the mapping that you wish to update with a transformation, then click anywhere in the row to expand details and choose the **edit** option:

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

...the field mapping is displayed in edit mode:

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

**Step 4**\
Click the **add transformation** button:

![](/files/tm8SDpp7dE89sKJL33s5)

...the **transformation editor** is displayed:

<figure><img src="/files/3OWHGLFTLZqAPDlwqEin" alt=""><figcaption></figcaption></figure>

**Step 5**\
Click the **add new function** button:\
\
![](/files/giohtWPjT61TfV1m5qnb)

\
...settings for the new function are shown: &#x20;

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

**Step 6**\
Click in the **function name** field and select the type of function that you'd like to add:

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

**Step 7**\
Depending on the type of function you select, additional fields are displayed for you to complete. Update these as required and click the **save function** button:

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

...the new function is added to the **transformation editor**:\
\
![](/files/PeCmuOHErsit2aKBJPay)

{% hint style="info" %}
If your transform uses a **type** conversion (for example, converting a string type to a date type) and your transformed data type does not match the destination, you will need to add a **convert to function** before the function can be saved.
{% endhint %}

**Step 8**\
Repeat these steps to add any more functions that you need. When you're ready, click the **save transformation** button (at the bottom of the **transformation editor** page):\
\
![](/files/EUdxb7W8pIr4WmOmzn8U)

...you'll exit back to the field mapping in edit mode:

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

**Step 9**\
Click the **done** button to confirm changes:\
\
![](/files/jDQZTXLXFBW23h5YprXh)

## Deleting an existing function or transformation

**Step 1**\
Follow steps [1 to 3 above](#adding-a-new-transformation) to edit the required field mapping.  The mapping is shown in edit mode and - if transformations are present - you will see an **edit transformation** button:

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

**Step 2**\
Select the **edit transformation** button to open the **transformation editor**. Here, any existing functions for the transformation are shown:

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

**Step 3**\
Select the function that you wish to remove - settings for this function are displayed in the right-hand panel:

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

**Step 4**\
Click the **delete function** button:

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

**Step 5**\
When prompted, confirm that you wish to proceed with this operation - the function is removed.

**Step 6**\
Keep in mind that a transformation may contain multiple functions. If no other functions are defined for this transformation, click the **delete transformation** button:\
\
![](/files/hhri8xgIJM0ulsG7Tne0)

...if other functions are defined for this transformation, click the **save** transformation button.<br>


---

# 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/patchworks-services/working-with-services/field-mappings-and-transformations-services/field-transformations-services.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.
