# Custom string transform function

## Introduction

The **custom string** transform function is used to map a given string to a target field. This string can be static, or you can reference [flow variables](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables/referencing-flow-and-meta-variables-in-mapping-transformations) and [cached data](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/referencing-a-cache-in-mapping-transformations).

{% hint style="info" %}
If you've added/updated a [map shape](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/standard-shapes/map-shape) before, you'll be used to selecting a **source** field and a **target** field. However, when a **custom string** transformation is used we don't select a **source** field - the **custom string** transformation is our data source.
{% endhint %}

## Adding a custom string transform

**Step 1**\
In your process flow, access settings for your map shape:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FWVyqnULF7g5M3Pd7G8aN%2Fcustom%20string%201.jpg?alt=media&#x26;token=ff64e072-de9d-409d-b428-5d8ccfc9fdad" alt="" width="261"><figcaption></figcaption></figure></div>

**Step 2**\
Select the **add transform** button for the required mapping rule - 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%2FxOOae75HpSijTH2Ou8AJ%2Fmap%20transform%203.jpg?alt=media&#x26;token=9f624f78-9604-47d4-b599-86d75760b7ce" alt="" width="375"><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%2F3Ua8TKaE4TZFejZDXzLl%2Fmap%20transform%204.jpg?alt=media&#x26;token=9ad403ed-d029-4c81-ab5c-ee9839b6316d" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 4**\
Click in the **name** field to access a list of all available transform functions, then select **custom string**:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FYQ8TdDHNMWeZoFR1gZfu%2Fmap%20transform%205.jpg?alt=media&#x26;token=1a241fd3-5b8c-4e06-b3d8-72b9fd0306ab" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 5**\
Move down to the **custom string** field and enter your required text or variables - 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%2FayQqCh0Uw3l8WLs4Cqew%2Fmap%20transform%206.jpg?alt=media&#x26;token=2853b047-07a5-4396-aa0f-d21c056fac3f" alt="" width="375"><figcaption></figcaption></figure></div>

{% hint style="info" %}
For more information about referencing flow variables in a custom string, please see our [Referencing flow variables in field mapping transformations](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/dynamic-variables/flow-variables/referencing-flow-and-meta-variables-in-mapping-transformations) page. For more information about referencing cached data in a custom string, please see our [Referencing a cache in mapping transformations](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows/process-flow-shapes/advanced-shapes/cache/referencing-a-cache-in-mapping-transformations) page.
{% endhint %}

**Step 6**\
Accept your changes:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F6lK526cqzn67sejLGOlS%2Fmap%20transform%207.jpg?alt=media&#x26;token=e0b8109e-ecef-418a-a46a-24e72a9ab2e8" alt="" width="375"><figcaption></figcaption></figure></div>

...then save the transformation:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FFtS8qnNG4oYhV1SeWxcd%2Fmap%20transform%208.jpg?alt=media&#x26;token=bf2fae02-0a40-44f7-aeee-7cefd1732959" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 7**\
Now you can select a target field in the usual way - 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%2F1hG7URex0oKXVNdfuKUc%2Fmap%20transform%209.jpg?alt=media&#x26;token=9819a58e-8213-458f-ac2a-ed981ecc58cd" alt="" width="375"><figcaption></figcaption></figure></div>

...then:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FzWNexMmXEFYjso1QMYn7%2Fmap%20transform%2010.jpg?alt=media&#x26;token=644c0ddc-ec97-4745-8896-e12cd72f2098" alt="" width="375"><figcaption></figcaption></figure></div>

...then:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FwXpTWKTeHfRQPk2FFmgi%2Fmap%20transform%2011.jpg?alt=media&#x26;token=ff6f1e13-5428-457b-8b96-eaa70d4bea1a" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 8**\
Once your mapping is complete, the row should be displayed without a source 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%2FRQf6U2KUWJF5TGf2100h%2Fmap%20transform%2012.jpg?alt=media&#x26;token=74e73b18-d889-4249-82fe-cf447d99bf5d" alt="" width="375"><figcaption></figcaption></figure></div>

From here you can save changes or add more mapping rules as needed. Next time the process flow runs, the **custom string** (or associated values from variables) will be mapped to the given target field.
