# Netsuite

![Netsuite_Logo.svg](https://assets.relyanceuat.xyz/images/docs/22315082311437/22315038749197.svg)
NetSuite is a cloud-based Software as a Service (SaaS) business management platform. It consists of a suite of applications that help companies run their business, understand the performance of their businesses and drive major efficiency gains and cost savings.

In order to integrate NetSuite with Relyance AI you will need a **Certificate ID**, **Account ID**, and **Client ID**.

This integration requires you to generate a *Machine to Machine* security certificate in Relyance and upload it into NetSuite to access your Relyance scan application.

#### In the Relyance AI application (part 1):

We will now generate a **Machine to Machine** security certificate to be used in NetSuite.

1. Login to your Relyance account.
2. Navigate to the **Settings** Menu in the bottom left-hand side.
3. Select **Integrations**.
4. Click on the **Vendor Integration** tab.
5. Find the **NetSuite** integration card and click it to open its connections.
6. Under **Authentication Method**, choose **Machine to Machine**.

![Netsuite-M2M-2.png](https://assets.relyanceuat.xyz/images/docs/22315082311437/22315045678605.png)

8. In the Certificate field click **Generate Certificate**.
9. This will open a prompt dialog. Enter the following: **Algorithm**: Choose one of the available options.
**Validity (days)**: Choose the length of time this certificate is valid for - Maximum 2 years (730 days).

![Netsuite-M2M-3.png](https://assets.relyanceuat.xyz/images/docs/22315082311437/22315053072909.png)

If you've previously created a Certificate and Key, use the **Import Existing Certificate and Key checkbox** and you'll be given the option to upload them
10. Click **Generate**.
11. Download both **Certificate** and **Key**.
12. Leave this webpage open to continue the integration in part 2

#### In NetSuite:

We'll begin by creating an OAuth2 application in NetSuite

1. Login to your NetSuite account
2. The **Account ID** will be the ID found in your NetSuite URL. Copy this to be used in Relyance
3. On the homepage navigation menu click the **Setup** dropdown menu item and select **Company**> **Enable Features**
4. This will bring you to the **Enable Features** page. On this page there is a second navigation menu bar, click the **SuiteCloud** item
5. Scroll to the **SuiteTalk (Web Services)** section and enable the **REST WEB SERVICES** checkbox
6. Scroll down to **Manage Authentication** and enable the **OAUTH 2.0** checkbox
7. On NetSuite portal, Go to Setup/Company/Enable Features and on tab **Analytics** check the option **SuiteAnalytics Workbook**
8. Click **Save** at the bottom of the page
9. Click the **Setup** dropdown menu item and select **Integration**> **Manage Integrations**
10. Click the **NEW** button
11. Fill out the form with the following values:
    1. **NAME**: Provide a meaningful name (e.g. Relyance Scan)
    2. **STATE**: Enabled
    3. **TBA: AUTHORIZATION FLOW:** Uncheck
    4. **TOKEN-BASED AUTHENTICATION**: Uncheck
    5. **AUTHORIZATION CODE GRANT**: Uncheck
    6. **CLIENT CREDENTIALS (MACHINE TO MACHINE) GRANT**: Check
    7. **REST WEB SERVICES**: Check
    8. **RESTLETS**: Check
12. Click **Save**
13. This will add a section with your newly created **Client ID** and **Client Secret**. Copy the **Client ID** to be used in Relyance  Now that we've generated the **Machine to Machine certificate** (on Relyance), we will associate it to the application we created.
14. Create a new role (Setup --> Users/Roles --> Manage Roles --> New)
    1. Define a name, select ***Classic Center*** on ***Center Type***, check ***All*** on ***Subsidiary Restrictions***
    2. Scroll down for Permission session
        1. On ***Transactions*** tab add these items

        ![NetSuite-3.png](https://assets.relyanceuat.xyz/images/docs/22315082311437/22315068559885.png)

        ![NetSuite-4.png](https://assets.relyanceuat.xyz/images/docs/22315082311437/22315082276877.png)

        ![NetSuite-5.png](https://assets.relyanceuat.xyz/images/docs/22315082311437/22315038758541.png)
        ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/36555254253453.png)
        ![Netsuite-M2M.png](https://assets.relyanceuat.xyz/images/docs/22315082311437/22315053063821.png)
        ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571298336525.png)
        ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571298338189.png)
        ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571298339213.png)
        ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571298339853.png)

        ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571298340621.png)

        ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571298341261.png)

        ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571290141709.png)
        ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571298344717.png)

        ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571298345997.png)

        ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571290146317.png)

        ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571290150029.png)

| **Permission** | **Level** |
| --- | --- |
| Access Payment Audit Log | View |
| Audit trial | View |
| Automated Cash Application | Full |
| Bill purchase orders | View |
| Calculate Time | View |
| Cardholder Authentication | View |
| Cardholder Authentication Event | View |
| Cash Sale | View |
| Cash Sale Refund | View |
| Check | View |
| Copy Budgets | View |
| Customer Deposit | View |
| Customer Payment | View |
| Customer Refund | View |
| Deposit | View |
| Deposit Application | View |
| Estimate | View |
| Expense Report | View |
| Finance Charge | View |
| Find Transaction | View |
| Fulfil Orders | View |
| Invoice | View |
| Invoice Sales Orders | View |
| Item Fulfilment | View |
| Item Receipt | View |
| Journal Approval | View |
| Make Journal Entry | View |
| Opportunity | View |
| Pay Bils | View |
| Purchase Order | View |
| Receive Order | View |
| Receive Returns | View |
| Refund Returns | View |
| Return Authorization | View |
| Sales Order | View |
| Sales Order Approval | View |
| Vendor Bill Approval | View |
| Vendor Payment Approval | View |
| Vendor Return Auth Approval | View |
| Vendor Return Authorization | View |
| Vendor Return | View |
| View Payment Events | View |
| View Payment Result Previews | View |
2. On ***Reports*** tab add these items

| **Permission** | **Level** |
| --- | --- |
| Account Detail | View |
| Accounts Payable | View |
| Cash Flow Statement | View |
| Employee Reminders | View |
| Expenses | View |
| Financial Statements | View |
| Purchase Order Reports | View |
| Purchases | View |
| Return Authorization Reports | View |
| Sales | View |
| Sales By Partner | View |
| Sales By Promotion | View |
| Sales Order Fulfilment Reports | View |
| Sales Order Reports | View |
| Sales Order Transaction Report | View |
| SuiteAnalytics Workbook | Edit |
| Tax | View |
| Transaction Detail | View |

3. On ***Lists*** tab add these items
4. On ***Setup*** tab add these items
3. Save the changes
15. Associate the role created with the user that will be used to setup (Setup --> Users/Roles --> Manage Users)
    1. In the session **Access** add the new role and save the changes
16. Click the **Setup** dropdown menu item and select **Integration > OAuth 2.0 Client Credentials (M2M) Setup**
    1. On this page click the **Create New** button
    2. In the resulting dialog select:
        1. **ENTITY**: Choose the user selected in the previous step (NetSuite - Step 15)
        2. **ROLE**: Choose the Role created in previous step (NetSuite - Step 14)
        3. **APPLICATION**: The name of the OAuth2 application created in the previous step (NetSuite - Step 9)
        4. **CERTIFICATE**: The certificate file created from Relyance integrations page (Relyance Part 1- Step 10)
    3. Once filled out click **Save.**
    4. When the application back to the list page, search for register created (sorting by Created At)
    5. Copy the ***Certificate ID*** from the credentials page

    ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571298351885.png)

    ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571290154765.png)

    ![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571298355469.png)

#### In the Relyance AI application (part 2):

Now that the application has been created and the security certificate associated with it, we can complete our Relyance integration.

1. Return to the NetSuite integration page in Relyance.
2. If processing DSRs, click the **Process DSRs** checkbox.
3. Paste: **Certificate ID**: NetSuite - Step 16 --> Sub-step - 5 **Account ID**: NetSuite - Step 2 **Client ID:** NetSuite - Step 13 If you've closed this page, you'll need to upload your previously created certificate and key file.
4. Click **Authenticate**.
5. This will bring up NetSuite page to allow Relyance permissions to connect. Click **Allow**.
6. At this point, you should see the following result on the **Vendor** Integrations page:
7. Congratulations, you are now connected to **NetSuite**.

![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571298356621.png)

![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571290159373.png)

![Screenshot](https://assets.relyanceuat.xyz/images/docs/22315082311437/37571290160653.png)

### Verify the connection is really working

1. **REST Web Services must be enabled on the account.** Under **Setup › Company ›
   Enable Features › SuiteCloud**, both **REST Web Services** and **OAuth 2.0** have
   to be on. Without them the token request fails before any permission is
   evaluated — the integration requests the `rest_webservices` scope and nothing
   else, so this is the whole surface.
2. **The role is where scans go empty.** Authentication proves the integration user
   exists; what it can read comes from the role you built and assigned. A role
   missing a record type omits it silently rather than failing.
3. **The certificate method needs both halves.** **Certificate** and **Certificate
   ID** are separate fields, and the ID is the value NetSuite shows *after* you
   upload the certificate — not the certificate's own filename or serial.
4. **Concurrency is governed by NetSuite, not by us.** **Maximum Concurrent API
   Calls** defaults to 10; if your account's concurrency limit is lower, requests
   are rejected with a governance error and the scan looks intermittent. Lower it to
   match your account tier.

<!-- auth-methods:begin (generated from the integration catalog; do not hand-edit) -->

## Authentication methods and fields

Pick one of these under **Authentication Method** on the connection wizard's **Authentication** step. This table is generated from the integration catalog, so it always matches what the form actually asks for.

| Method | Required | Optional |
| --- | --- | --- |
| **Oauth2 / App Token** | `Account ID`, `Client ID`, `Client Secret` (secret) | `Maximum Concurrent API Calls` |
| **Machine to Machine** | `Certificate` (secret), `Certificate ID`, `Account ID`, `Client ID` | `Maximum Concurrent API Calls` |

<!-- auth-methods:end -->

<!-- terraform-examples:begin (generated from the integration catalog; do not hand-edit) -->

## Manage this integration with Terraform

Connections for this integration can be managed as code with the [Relyance Terraform provider](https://registry.terraform.io/providers/Relyance/relyance/latest). Non-secret fields go in `auth.params`; secret fields go in `auth.secrets_wo`, which is write-only — never stored in Terraform state. Rotate secrets by bumping `auth.secrets_wo_version`.

### OAuth (browser authorization)

The **OAuth (browser authorization)** method uses a browser authorization flow, so the connection is created in the Relyance app. Manage it in Terraform afterwards by importing it (`terraform import relyance_integration_connection.example netsuite/<connection_id>`) or reading it with the `relyance_integration_connection` data source.

### Certificate authentication

```hcl
resource "relyance_integration_connection" "netsuite_1" {
  vendor = "netsuite"
  name   = "<your connection name>"

  auth = {
    method = "certificate"
    params = {
      certificate_id = "<certificate_id>"
      account_id = "<account_id>"
      client_id = "<client_id>"
      data_storage_location = "us"
    }
    # Secret fields are write-only: sent to Relyance, never stored in state.
    secrets_wo = {
      certificate = var.netsuite_certificate
    }
    secrets_wo_version = 1
  }

  scans = { "data-inspection" = { enabled = true } }
}
```

<!-- terraform-examples:end -->
