# Working with NetSuite custom fields (services)

## Introduction

In Patchworks, [field mappings](https://doc.wearepatchworks.com/product-documentation/patchworks-services/working-with-services/field-mappings-and-transformations-services/field-mappings-services) are used to ensure that data pulled from fields in a source system, is mapped to the correct fields in a given destination system.&#x20;

When you [add or edit field mappings](https://doc.wearepatchworks.com/product-documentation/patchworks-services/working-with-services/field-mappings-and-transformations-services/field-mappings-services) for a service, Patchworks makes life simple by providing lists of standard fields for the associated source and destination systems. Additionally, non-standard, [custom fields can be mapped](https://doc.wearepatchworks.com/product-documentation/patchworks-services/working-with-services/field-mappings-and-transformations-services/field-mappings-services#mapping-custom-fields).&#x20;

NetSuite custom fields work in a very particular way, as summarised below.

## Pushing data to NetSuite custom fields&#x20;

The following information relates to the structure of custom field mappings for services where NetSuite is defined as the **destination**. If you're  adding/managing field mappings via the advanced editor (rather than via the dashboard field mapping UI), please keep these details in mind.

{% hint style="info" %}
If you are using the [dashboard UI](https://doc.wearepatchworks.com/product-documentation/patchworks-services/working-with-services/the-anatomy-of-a-service/service-mapping) to add/manage field mappings, this structure will be reflected as you navigate mappings for custom fields - information in this section may be useful background but you don't need to take any special action.&#x20;
{% endhint %}

Custom fields are organised into parts - for example:

* Customer
* Customer deposits

Each part includes a **customFieldList** and this must be referenced in the path specified for a mapping. The example below shows how we might map to a custom field named **cseg\_channel\_type**:&#x20;

<figure><img src="https://content.gitbook.com/content/5mpqoXPMbUuPa8JpCLWe/blobs/s9YzpnyHan4nRvI5MxO1/custom%20fields%20example%20.png" alt=""><figcaption></figcaption></figure>

Here:

**1** is the path to the custom fields part (**customerDeposits**)

**2** is the path from the custom fields part to the custom fields list (**customFieldList**)

**3** is the name of the custom field (**cseg\_channel\_type**)

## Pulling data from NetSuite custom fields&#x20;

The following information relates to the structure of custom field mappings for services where NetSuite is defined as the **source**. If you're  adding/managing field mappings via the advanced editor (rather than via the dashboard field mapping UI), please keep these details in mind.

{% hint style="info" %}
If you are using the [dashboard UI](https://doc.wearepatchworks.com/product-documentation/patchworks-services/working-with-services/the-anatomy-of-a-service/service-mapping) to add/manage field mappings, this structure will be reflected as you navigate mappings for custom fields - information in this section may be useful background but you don't need to take any special action.&#x20;
{% endhint %}

When pulling records with custom fields, they will be in the following format:

{% code lineNumbers="true" %}

```
Orders.0.customFields.custom_field_name_from_netsuite.name
```

{% endcode %}

### Dropdown fields

Some custom fields may be dropdown fields - for example:

<div align="left"><figure><img src="https://content.gitbook.com/content/5mpqoXPMbUuPa8JpCLWe/blobs/Wr1cB8atAxlNkUYsjhLt/ns%20custom%20field%20dropdown.png" alt=""><figcaption></figcaption></figure></div>

In this case, the multiple fields would be mapped as:

{% code lineNumbers="true" %}

```
Orders.0.customFields.custom_field_name_from_netsuite.entityId
Orders.0.customFields.custom_field_name_from_netsuite.typeId
Orders.0.customFields.custom_field_name_from_netsuite.externalId
Orders.0.customFields.custom_field_name_from_netsuite.name
```

{% endcode %}

### Sub arrays

If custom fields are present in a sub array, the format would be the same from that point. In the example below, we show a custom field in the **itemList** sub array:

{% code lineNumbers="true" %}

```
Orders.0.itemList.item.o.customFields.custom_field_name_from_netsuite.name
```

{% endcode %}
