# Preparing your NetSuite environment to work with Patchworks

## Introduction

Before your Patchworks Netsuite connector can be used in process flows, some setup is required in your NetSuite environment. This setup allows Patchworks to authorise API calls with token-based authentication.

{% hint style="info" %}
When you [add a Patchworks connector instance](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/working-with-instances/adding-an-instance) for NetSuite, you can choose to authenticate using OAuth 1 or OAuth 2. The OAuth protocol authenticates users via tokens, so this setup is imperative.
{% endhint %}

## Prerequisites

* You will need NetSuite administrator permissions to complete tasks detailed on this page.

## The steps

The required setup is detailed in five stages:

* [Stage 1: Enable REST API features](#stage-1-enable-rest-api-features)
* [Stage 2: Create a role to give access to the REST API & token-based authentication](#stage-2-create-a-role-to-give-access-to-the-rest-api-and-token-based-authentication)
* [Stage 3: Check/assign permissions for your Patchworks role](#stage-3-check-assign-permissions-for-your-patchworks-role)
* [Stage 4: Assign the role to a user](#stage-4-assign-the-role-to-a-user)
* [Stage 5: Add a Patchworks integration](#stage-5-add-a-patchworks-integration)

### Stage 1: Enable REST API features

Follow the steps below:

**Step 1**\
In NetSuite, login as an admin user and navigate to **setup** | **company** | **enable features**:

&#x20;![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FOg8lCshQrM2P8tBrMjIR%2Fns%20enable%20features%201.png?alt=media\&token=741eebd3-cfb7-425f-89f0-292bb93862cc)

**Step 2**\
Select the **SuiteCloud** tab - all available features are listed within a series of categories.&#x20;

**Step 3**\
Scroll to the **SuiteTalk (Web Services)** category and ensure that the following features are selected/enabled:

* SOAP WEB SERVICES
* REST WEB SERVICES&#x20;
* REST RECORD SERVICE (BETA) - if available

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%2F0HyjB8abcGUCKGu1URF1%2Fnetsuite%20auth%200.png?alt=media&#x26;token=4631539f-5873-4eb0-8b1a-97cf1af05f17" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
If you don't see the **REST RECORD SERVICE (BETA)** option, look for a blue banner at the top of the **setup** | **company** | **enable features** page:\
\
![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FkJpog5Kg6qFeKK2kBsK6%2Fns%20option.png?alt=media\&token=3e596613-bf34-46dc-ae99-4c6da01b431e)\
&#x20;\
Use the **click here** link to view Beta activities and apply to participate in the **Oracle NetSuite Umbrella Beta Program** Beta activity:\
\
![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FU6OUZBZE3erJ8axJZN2p%2Fns%20option%202.png?alt=media\&token=e6ccc067-a4ab-4268-a3bd-00b94fbdb749)

If you don't see the the **REST RECORD SERVICE (BETA)** option and there's no banner for you to opt in, don't worry - it's not required.
{% endhint %}

**Step 4**\
Scroll to the **Manage Authentication** category and ensure that the following features are selected/enabled:

* TOKEN-BASED AUTHENTICATION
* OAUTH 2.0

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%2FuQ1hKrR4M4DyB50wVz6J%2Fnetsuite%20auth%201.png?alt=media&#x26;token=1d3dfaf8-64e6-43fb-a880-668540e3a913" alt=""><figcaption></figcaption></figure></div>

You may find that some features (including other authentication settings) are already set when you access the **enable features** page in NetSuite. This is fine.

**Step 5**\
Save changes.

### Stage 2: Create a role to give access to the REST API & token-based authentication

{% hint style="info" %}
Adding a new role is optional - if you have an existing role that you would like to use that's fine - you can simply select that role (via **setup** | **users/roles** | **manage roles**) and go straight to [stage 3](#stage-3-check-assign-permissions-for-your-patchworks-role).
{% endhint %}

**Step 1**\
In NetSuite, login as an admin user and navigate to **setup** | **users/roles** | **manage roles**:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FWvtq5hkN4oQBRzWLrTws%2Fnetsuite%20roles%201.png?alt=media&#x26;token=f9b4801f-ea34-44fd-a5cf-96e1c574f842" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 2**\
Click the **new role** button:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fvt0aIwdpODLfOug1VhHc%2Fnetsuite%20roles%202%20.png?alt=media&#x26;token=45bd634d-76b6-48fb-bd8e-654da31e3659" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 3**\
In the **name** field enter a name for this role, we suggest:

```
Patchworks Integration
```

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%2FHucKoIWdoLb63dF2pibd%2Fnetsuite%20roles%202%20a.png?alt=media&#x26;token=05f73665-8af1-4760-8df8-b2af3ee19a9f" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 4**\
Go directly to [stage 3](#stage-3-check-assign-permissions-for-your-patchworks-role).

### Stage 3: Check/assign permissions for your Patchworks role

**Step 1**\
In the lower panel, select the **permissions** tab:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FfVd3m0f28eEVqYxwf643%2Fnetsuite%20roles%203.png?alt=media&#x26;token=b2115ded-b855-4b77-94b8-34421bcb8323" alt=""><figcaption></figcaption></figure></div>

Here, you use permission tabs to navigate between different permission categories:

<figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FpoWKORWXFuahxCzWZ8ed%2Fnetsuite%20roles%203a.png?alt=media&#x26;token=f01713b0-1fc7-480b-a2fd-f2fafa71ec97" alt=""><figcaption></figcaption></figure>

**Step 2**\
Switch between these categories and ensure that the following permissions are granted:

| Category     | Permission                                                                                                                                                                                                                                                                                                                                                                                                                            | Access level             |                                  |                               |      |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | -------------------------------- | ----------------------------- | ---- |
| Setup        | Accounting lists                                                                                                                                                                                                                                                                                                                                                                                                                      | View                     |                                  |                               |      |
| Setup        | Customer status                                                                                                                                                                                                                                                                                                                                                                                                                       | Full                     |                                  |                               |      |
| Setup        | Custom fields                                                                                                                                                                                                                                                                                                                                                                                                                         | View                     |                                  |                               |      |
| Setup        | Custom body fields                                                                                                                                                                                                                                                                                                                                                                                                                    | View                     |                                  |                               |      |
| Setup        | Custom entity fields                                                                                                                                                                                                                                                                                                                                                                                                                  | View                     |                                  |                               |      |
| Setup        | Custom record types                                                                                                                                                                                                                                                                                                                                                                                                                   | View                     |                                  |                               |      |
| Setup        | Custom column fields                                                                                                                                                                                                                                                                                                                                                                                                                  | View                     |                                  |                               |      |
| Setup        | Custom item fields                                                                                                                                                                                                                                                                                                                                                                                                                    | View                     |                                  |                               |      |
| Setup        | Custom lists                                                                                                                                                                                                                                                                                                                                                                                                                          | View                     |                                  |                               |      |
| Setup        | Custom transaction fields                                                                                                                                                                                                                                                                                                                                                                                                             | View                     |                                  |                               |      |
| Setup        | Log in using access tokens                                                                                                                                                                                                                                                                                                                                                                                                            | Full                     |                                  |                               |      |
| Setup        | REST web services                                                                                                                                                                                                                                                                                                                                                                                                                     | Full                     |                                  |                               |      |
| Reports      | SuiteAnalytics workbook                                                                                                                                                                                                                                                                                                                                                                                                               | Edit                     |                                  |                               |      |
| Lists        | Subsidiaries                                                                                                                                                                                                                                                                                                                                                                                                                          | Full                     |                                  |                               |      |
| Lists        | Contacts                                                                                                                                                                                                                                                                                                                                                                                                                              | Full                     |                                  |                               |      |
| Lists        | <p>Currency<br><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FKvJZhQaEKfDOWvbHsbYe%2Ftip%20icon.svg?alt=media&#x26;token=975b37c4-e5e3-462c-a32f-cc72a5461cac" alt="" data-size="line"> This permission is only displayed if the multi-currency feature is enabled for your company. If you need to check this, navigate to <strong>setup</strong> | <strong>company</strong> | <strong>enable features</strong> | <strong>company</strong>.</p> | Edit |
| Lists        | Customers                                                                                                                                                                                                                                                                                                                                                                                                                             | Full                     |                                  |                               |      |
| Lists        | Entity-subsidiary relationship view                                                                                                                                                                                                                                                                                                                                                                                                   | Full                     |                                  |                               |      |
| Lists        | Items                                                                                                                                                                                                                                                                                                                                                                                                                                 | Full                     |                                  |                               |      |
| Lists        | Record custom field                                                                                                                                                                                                                                                                                                                                                                                                                   | Full                     |                                  |                               |      |
| Lists        | Payment methods                                                                                                                                                                                                                                                                                                                                                                                                                       | Full                     |                                  |                               |      |
| Lists        | Shipping items                                                                                                                                                                                                                                                                                                                                                                                                                        | Full                     |                                  |                               |      |
| Lists        | Perform search                                                                                                                                                                                                                                                                                                                                                                                                                        | Full                     |                                  |                               |      |
| Transactions | Customer deposit                                                                                                                                                                                                                                                                                                                                                                                                                      | Full                     |                                  |                               |      |
| Transactions | Customer payment                                                                                                                                                                                                                                                                                                                                                                                                                      | Full                     |                                  |                               |      |
| Transactions | Customer refund                                                                                                                                                                                                                                                                                                                                                                                                                       | Full                     |                                  |                               |      |
| Transactions | Find transaction                                                                                                                                                                                                                                                                                                                                                                                                                      | Full                     |                                  |                               |      |
| Transactions | Fulfill Orders                                                                                                                                                                                                                                                                                                                                                                                                                        | Full                     |                                  |                               |      |
| Transactions | Sales order                                                                                                                                                                                                                                                                                                                                                                                                                           | Full                     |                                  |                               |      |

**Step 3**\
Save changes.

### Stage 4: Assign the role to a user

{% hint style="info" %}
The steps below assume that you already have a NetSuite user ready to associate with the permissions granted above. However, you can create a new user if required. &#x20;
{% endhint %}

**Step 1**\
In NetSuite (logged in as an admin user), navigate to **setup** | **users/roles** | **manage users**:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FUhLhlbGvt19tb9HSE4su%2Fnetsuite%20user%201.png?alt=media&#x26;token=2e73949c-07fa-4ae7-b038-de3e2e6f7926" alt="" width="375"><figcaption></figcaption></figure></div>

**Step 2**\
From the list of users, select the user that you want to update with new permissions.

**Step 3**\
In the lower panel, select the **access** tab:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FnOvNn4O6e5KpxSji3vwR%2Fnetsuite%20user%202.png?alt=media&#x26;token=e7650b62-1514-4143-92b4-6516d24171db" alt="" width="563"><figcaption></figcaption></figure></div>

**Step 4**\
Assign the `Patchworks integration` role that you saved in [stage 3](#stage-3-check-assign-permissions-for-your-patchworks-role).

**Step 5**\
Save changes.

### Stage 5: Add a Patchworks integration

**Step 1**\
In NetSuite (logged in as an admin user), navigate to **setup** | **integration** | **manage integrations**.

**Step 2**\
Click the **new** button:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FoXVD462AWqj0ZGNJH4iw%2Fnetsuite%20int%201.png?alt=media&#x26;token=53386e51-b2e9-4354-a63e-bde4cfb5b6fc" alt="" width="563"><figcaption></figcaption></figure></div>

**Step 3**\
In the **name** field we suggest entering:

```
Patchworks Integration
```

**Step 4**\
Set the **state** field to **enabled**.

**Step 5**\
Move down to the **token-based authentication** section and select/de-select options as per your requirements:

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FPq80F8deQ3i4P3iazHRj%2Ficon%20decision.svg?alt=media&#x26;token=61be5bf3-7235-45fe-af5f-726229df8dd6" alt="" data-size="line"> I want to use OAuth 1 authentication in Patchworks</summary>

Ensure that the following options are selected:

* TOKEN-BASED AUTHENTICATION
* TBA: ISSUETOKEN ENDPOINT
* TBA: AUTHORIZATION FLOW
* CALLBACK URL set to <https://app.wearepatchworks.com/oauth/authenticate> for the Patchworks production environment&#x20;

For example:

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FK0eO1vxxB6XEyS3Rrhkq%2Ftoken%20options.png?alt=media\&token=70e2b697-8647-4eae-8ee5-4f4f4c00f76c)<br>

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FPq80F8deQ3i4P3iazHRj%2Ficon%20decision.svg?alt=media&#x26;token=61be5bf3-7235-45fe-af5f-726229df8dd6" alt="" data-size="line"> I don't want to use OAuth 1 authentication in Patchworks</summary>

Ensure that no token-based authentication options are selected.

</details>

**Step 6**\
Move down to the **OAuth 2.0** section and select/de-select options as per your requirements:

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FPq80F8deQ3i4P3iazHRj%2Ficon%20decision.svg?alt=media&#x26;token=61be5bf3-7235-45fe-af5f-726229df8dd6" alt="" data-size="line"> I want to use OAuth 2 (client credentials) authentication in Patchworks</summary>

Ensure that the following options are selected:

* CLIENT CREDENTIALS (MACHINE TO MACHINE) GRANT
* RESTLETS
* REST WEB SERVICES

Ensure that the following options are NOT selected:

* AUTHORIZATION CODE GRANT

For example:

![](https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2Fe1UaAl6UYEtsH2feM7KJ%2Foauth%202%20options.png?alt=media\&token=acd2d07f-cb01-444d-b20a-8f065cd51286)

</details>

<details>

<summary><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FPq80F8deQ3i4P3iazHRj%2Ficon%20decision.svg?alt=media&#x26;token=61be5bf3-7235-45fe-af5f-726229df8dd6" alt="" data-size="line"> I don't want to use OAuth 2 (client credentials) authentication in Patchworks</summary>

Ensure that no OAuth 2.0 options are selected.

</details>

**Step 7**\
Save changes. At this point, client credentials are provided for this integration - add these to your password manager:

<div align="left"><figure><img src="https://2440044887-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FCVyIwEWdSV9nGZiEqcdj%2Fnetsuite%20int%204.png?alt=media&#x26;token=15612f28-c969-4b8f-b456-7bfc0f3d9867" alt="" width="375"><figcaption></figcaption></figure></div>

{% hint style="warning" %}
These credentials are only displayed once and are needed to [add Patchworks instances](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/working-with-instances/adding-an-instance) of the NetSuite connector - make sure that you have them noted securely for future reference.
{% endhint %}

**Step 8**\
The required NetSuite setup is now complete. If you haven't done so already, [install the NetSuite connector from the Patchworks marketplace](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/working-with-connectors/installing-a-connector), then [add required instances](https://doc.wearepatchworks.com/product-documentation/connectors-and-instances/working-with-instances/adding-an-instance) and [make connections in process flows](https://doc.wearepatchworks.com/product-documentation/process-flows/building-process-flows)!
