Netsuite Integration

NetSuite Purchasing/Receiving Integration

Use the Set Up below for instructions on how to deploy this integration.

Sync purchase orders created, approved, or rejected in NetSuite with ION Purchases. This integration allows your organization to utilize NetSuite's advanced purchase order approvals, accounting, and finance systems. Once the purchase order is created in ION, receive the inventory from each purchase order into ION's inventory to be kitted, installed onto assemblies, and much more.


  • Purchases that do not yet exist in ION will be created and a custom attribute called "Netsuite PO Number" will store the NetSuite PO Number associated with the ION Purchase. These will not match so please use this value to compare NetSuite against ION.

  • Suppliers and Parts need to be manually maintained in both systems in order for the ION purchase to be correctly populated. Warning logs will appear that let you know when parts or suppliers do not exist in ION.

  • Receiving: Upon saving a receipt in ion (pressing Save Receipt), an itemReceipt will be created in NetSuite for the purchase order linked to the receipt.

Purchase Order Statuses

NetSuite StatusION Status

Pending Supervisor Approval


Approved by Supervisor

Pending Receipt Partially Received


Rejected by Supervisor


Pending Bill,

Fully Billed



PO Lines are marked as Paid


  1. Follow the intial setup on the Automations page to get started.

  2. In order to authenticate with NetSuite, please follow these instructions as an administrator:

    1. Enable SuiteTalk

      • Navigate to Setup > Company > Enable Features

      • Under the Suite Cloud tab, ensure that both REST WEB SERVICES and OAUTH 2.0 are checked.

    2. To Create an OAuth 2.0 app with JWT Option

      • Go to Setup > Integration > Manage Integrations > New

      • Give your integration a name and a description.

      • Un-check TOKEN-BASED AUTHENTICATION and TBA: AUTHORIZATION FLOW under Token-based Authentication

      • Ensure the following are checked under OAuth 2.0



      • Take note of and save your CONSUMER KEY and CONSUMER SECRET as it will not be shown again in Netsuite after this step

    3. Generating the Certificate ID and Private Key for JWT

      • A private key is required for JWT-based authentication. Follow the steps below or refer to the NetSuite Documentation for generating or importing a private key.

      • On your machine create a valid certificate abiding by the Netsuite requirements using OpenSSL in a terminal. This will generate two .pem files on your local machine containing key used as the Private Key for JWT information and the certificate for the next step

        • Example query: openssl req -x509 -newkey rsa:4096 -sha256 -keyout auth-key.pem -out auth-cert.pem -nodes -days 730

        • .pem files generated: auth-key.pem, auth-cert.pem

      • In Netsuite, navigate to Setup > Integration > OAUTH 2.0 CLIENT (M2M) SETUP and select Create New

      • Choose the proper Entity, Role, and select the Application created in the previous section.

      • For Certificate choose the auth-cert.pem file generated in the previous steps.

      • Press save

      • Once saved, a Certificate ID is generated. Save this for the Prismatic integration.

    4. In your Prismatic Integration Connection configuration Select the Netsuite OAuth 2.0 Client Credentials connection Type and enter the following:

  3. Configure your custom attributes by mapping ION custom attribute name (left) to the attribute name in your Netsuite instance. Below is an EXAMPLE of what a mapping can look like. Please reach out to your Netsuite IT administrator or consultant to get a list of attributes to map.

  1. For the integration to work successfully you need to create the following custom attributes in your organization settings:

    1. purchase order -- key: "Netsuite PO Number", type: String

    2. purchase order -- key: "Netsuite RecordID", type: String

    3. purchase order line -- key: "Non-receivable", type: Boolean

  2. Hit Finish and take note of the URL for the Purchasing Flow

  3. Create a custom script by navigating to Customization > Scripting. Save the below script locally and use that when creating a new script. The script that will send updates to ION when Purchase Orders in NetSuite are updated and created. Update the URL in the HTTPS POST method to the URL you copied from above.

    1. WARNING: When you upload the script, ensure that your script name has .js after it or you will get a 'MODULE NOT FOUND' error when saving a purchase order.

  * @NApiVersion 2.x
  * @NScriptType UserEventScript
  * @NModuleScope SameAccount 

define(['N/https', 'N/record'], function(https, record) {

    function afterSubmit(context) {   
        var newRecord = context.newRecord;
        log.debug("newRecord", newRecord);
        var purchaseOrderId = newRecord.id;
        log.debug("purchaseOrderId", purchaseOrderId);
        var poRecord = record.load({
            type: record.Type.PURCHASE_ORDER,
            id: purchaseOrderId,
            isDynamic: true
        log.debug("poRecord", poRecord);
        var poData = {
            POId: purchaseOrderId,
            tranId: poRecord.getValue({ fieldId: 'tranid' }),
            date: poRecord.getValue({ fieldId: 'trandate' }),
            vendor: poRecord.getValue({ fieldId: 'entity' }),
            status: poRecord.getValue({ fieldId: 'status' }),
        log.debug("poData", poData);
        var payload = JSON.stringify(poData);
        var response = https.post({
            url: 'https://hooks.prismatic.io/trigger/SW5zdGFuY2VGbG93Q29uZmlnOmE4M2JiM2I2LTg0ZTctNGUxNy05MzEwLTg0NDQzYzFiYzMzNQ==', 
            // Replace with your actual HTTP endpoint URL
            body: payload,
            headers: {
            'Content-Type': 'application/json'
        var responseBody = response.body;
        var responseCode = response.code;
        log.debug('HTTP Response', 'Code: ' + responseCode + ', Body: ' + responseBody);
    return {
        afterSubmit: afterSubmit
  1. Hit Deploy Script and deploy the script to Purchase Orders. Set the attributes according to the image below.

Last updated