Prerequisites for Creating a Connection

You must satisfy the following prerequisites to create a connection with the Oracle NetSuite REST Adapter.

Obtain the NetSuite Account ID, Client ID, Client Secret, and Scopes for Security Policies

  1. Log in to the NetSuite application.

    The NetSuite application homepage appears.

  2. Retrieve the account ID from the application URL.
    For example, if the application URL is as follows:
    https://111****21.app.netsuite.com

    Then the account ID is 111****21.

  3. Go to Setup, then New, and then Manage Integrations.
  4. On the Integrations page, perform the following steps:
    1. Enter the integration name.
    2. Select the Authorization Code Grant or/and Client Credentials (Machine to Machine) Grant checkbox.

      Note:

      • You must select the Client Credentials (Machine to Machine) Grant checkbox when using the JWT Client Credentials Assertion for NetSuite security policy.
      • For the OAuth Authorization Code Grant flow, you can set the refresh token validity in the NetSuite integration record to any value between 1 hour and 720 hours (30 days).
    3. Select the Public Client checkbox.
    4. Select required scopes such as RESTLETS, REST Web Service, and others.
    5. Enter the redirect URI in the Redirect URI field.
    6. Click Save.

    A new integration is created.

  5. Make note of the client ID and client secret values in the Client Credentials section.

    Note:

    • For security purposes, the client ID and client secret are generated and shown one time. If you do not make note of these values, you cannot regenerate them.
    • The generated client ID also serves as the consumer key and can be used for the JWT Client Credentials Assertion for NetSuite security policy.

Certificate ID and JWT Private Key Alias for JWT Client Credentials Assertion for NetSuite Security Policy

Prerequisites for the HMAC Signature Validation Security Policy

Obtain the Shared ID and Shared Secret
  1. Log in to the NetSuite application.
  2. Navigate to SetUp, then Company, and then API Secret.
  3. On the API Secret Page, click Create Secret.
  4. In the Create New Secret dialog, enter the required details:
    • Name
    • ID
    • Password
    5. Click Save.

    Note:

    The ID and password entered here are used for the shared ID and shared secret while integrating with the Oracle NetSuite REST Adapter using the HMAC Signature Validation policy.
Obtain the Endpoint URL
  1. Once you have configured the Oracle NetSuite REST Adapter connection as a trigger, activate the integration.
  2. After the integration is activated, navigate to the Run Details page and click Metadata URL.
  3. On the page that opens, copy the endpoint URL.
Create a Script
  1. Use a JavaScript source code editor to create a JavaScript file.
  2. Define the following in the script:
    • The events that trigger the integration, such as Create, Update, and Delete.
    • The endpoint URL of the integration. For more information, see Obtain the Endpoint URL.
    • The Shared ID obtained. See Obtain the Shared ID and Shared Secret.
    • The fields to include in the notification payload.

      Note:

      A customizable sample JSON payload is available here:

Upload and Deploy the Script

Follow the instructions below to upload your script into the NetSuite application.
  1. Navigate to Customization, then Scripting, then Scripts, and then New.
  2. Upload the JavaScript file and provide a meaningful name.
  3. Click Create Script Record to create a script for the uploaded file.
  4. Enter a meaningful script name.
  5. Click Save.
  6. Click Deploy Script.
  7. On the Script Deployment page:
    1. In the Applies To field, select the modules for which the script should trigger events. You can select specific modules or all modules. For example, select Account, Bill Payment, Customer, or all records.
    2. In the Execute As Role field, select Administrator.
    3. Click Save.
  8. To verify if the scripts have been successfully deployed, navigate to Customization, then Scripting, and then Script Deployment.
  9. Confirm that the deployed script appears in the Script Deployments list.