ION Factory OS
  • Welcome to ION
  • Features
    • Procedures
      • Steps
        • Content
        • Datagrid
        • Fields
        • Attributes
      • Dependencies
      • Part-Procedure Relationship
      • Attributes
      • Standard Steps
      • Installation Requirements (Beta)
      • Nested Steps and Nested Standard Steps
      • Procedure Best Practices
    • Runs
      • Run Execution Overview
      • Runs And Step States
      • Batching Runs
        • Batching 2.0 Changes
      • Workcenter execution
      • Split Inventory on a Run
      • Redlines
      • Export run data
      • Scheduling runs
      • Time Tracking
      • Attributes
      • Outside Processing
      • Runs Best Practices
    • Parts Library
      • As-built Bill of Materials (aBOM)
        • Editing aBOM build requirements
        • aBOM Beta Changes
          • aBOM actions for developers
      • Inventory
        • Inventory status
        • Inventory splitting
        • Inventory merging
        • Inventory scrapping
        • Kitting
        • Inventory Movement Automations
      • Manufacturing bill of materials (mBOM)
        • mBOM versions
        • Made on Assembly (MOA)
        • Part Substitutes
        • Reference designators
      • Part Attributes
      • Part revision interchangeability
      • Supplier Part Numbers & Purchase Unit Conversions
    • Kitting and Inventory Fulfilment
      • Kit Statuses and Workflows
      • Inventory requests
      • Kitting and runs
      • Fulfilling Multiple Kits
      • Kanban Kitting
    • Purchasing
      • Purchase Orders
        • Types of Purchases
        • Purchase Order Approvals
        • Purchase Order FAQs
        • Supplier Part Numbers & Unit Conversions
        • PO Requirements, Terms, and Quality Clauses
      • Receiving/Inspection
      • Outside Processing
      • Consigned Parts
    • Barcode Labels
      • Templating
        • ION barcode minimum sizes
        • Sample templates
      • Printing
        • Configuring Zebra Browser Print
        • Server Based Barcode Printing (PrintNode)
      • Scanning
        • Scan barcodes from other systems
    • Quality
      • Issues
      • Further Actions - CAPA
      • Issues States, Dispositions, and Resolutions
      • Quality Best Practices
    • Tools
    • Locations
    • Attributes
    • Labels
      • Deleting labels
    • Notifications
    • Search
    • Settings
      • Role based access control
        • Full Glossary of ION Permissions
    • ION Actions
      • ION Actions examples for Quality
      • ION Actions examples for Runs and Procedures
      • ION ACTIONS examples for Supply Chain
  • Analytics
    • Inventory valuation
    • Part impact analysis
    • Users, Roles, Teams
    • Analytics FAQ
    • Data Connector
    • Data Products
  • Plans and Autoplan
    • Autoplan
    • Autoplan glossary
    • Preparing to use Autoplan
    • Clear to build reporting
    • Running Autoplan on a schedule
    • Firm and blocked plan items
    • Location constraints
    • Autoplan suggested suppliers and procedures
    • Reorder point
    • Plan input serial numbers
    • Applying a calendar
    • Plan Reservations
    • Independent schedules
    • Drive demand from kits
    • Drive demand below buy parts configuration
    • Group plan items with the same date
    • Manualy Changing Autoplan Status
  • API
    • How to create an App with ION
    • Access Tokens
    • About GraphQL
    • Interactive API explorer
    • API Keys
    • Examples
      • Notifications
      • Runs
      • Automatically updating fields in runs
      • Parts and Part Revisioning
      • mBOMs
      • Part Inventory and Kitting
      • aBOM (As-built Bill of Materials)
      • Edit time-tracking session data
    • Changelog
    • Webhooks
    • Pagination
  • Automations
    • Auto-checkout of Run Steps
    • Auto-Consumption of Lineside Inventory
    • Automatically Send Purchases to Suppliers
    • Set Close by Run Step on Issue Creation
    • Intent Management / Grade / Tier / Pedigree
      • Data Imprinting
      • ION Actions for Intent
    • Auto-Update mBOM Revision on Part Revision Update
    • Auto-approve part-procedure relationships
    • Purchase Order PDF and Versions
    • Auto Populate PO Line Attributes
    • Imprint Attributes from One Object to Another on a Desired Event
  • Integrations
    • Deploying Integrations and Automations
    • Arena
    • Cofactr
    • Datum
    • Duro
    • NetSuite
      • Purchasing in NetSuite, Receiving in ION
      • Work Order/Assembly Builds
    • Procurable
    • PDF Generator
    • Quickbooks
    • Ramp
    • Silkline Integration
    • Slack
    • Smartsheet
    • SOLIDWORKS
    • Teamcenter
  • Training
    • Standard Operating Procedures
      • Cycle Counting
      • Tool Utilization
    • Guided Flows
    • ION Sandbox
    • Chat Support for ION
  • Troubleshooting
    • Resetting your password
    • Resetting your Multi-Factor Authentication
    • You have no roles... error
  • Changelog
  • Adminstration
    • Security
      • Backups and Security FAQ
      • Single Sign-On (SSO)
        • Okta SAML connection setup
      • Export Control
      • Report Generator Disclaimer
    • Browser and Device Compatibility
    • Authentication
      • My company is new to ION, logging in for the first time.
      • I'm told I'm not authorized to access the application
      • My account has been deactivated
    • Login Page
  • Tickets Portal
Powered by GitBook
On this page
  • Functionality
  • Setup

Was this helpful?

  1. Integrations
  2. NetSuite

Purchasing in NetSuite, Receiving in ION

PreviousNetSuiteNextWork Order/Assembly Builds

Last updated 6 months ago

Was this helpful?

Sync purchase orders created, approved, or rejected in NetSuite with . 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 and sync the receipts into NetSuite so you can 3 way match.

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

Functionality

  • 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.

    • Purchase order updates like line changes or header changes will be reflected on the ION side

  • Suppliers will be created in ION if they do not exist at the time of purchase

  • Parts need to be manually maintained in both systems for the ION purchase to be correctly populated. 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.

  • Upon closing a PO in NetSuite, open purchase order lines in ION will be canceled

  • Upon deleting a PO in NetSuite the PO will be deleted in ION

Purchase Order Statuses

NetSuite Status
ION Status

Pending Supervisor Approval

Draft

Approved by Supervisor

Pending Receipt Partially Received

Ordered

Pending Bill,

Fully Billed

Received

Closed

Canceled

Setup

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

  2. 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

        • REST WEB SERVICES

        • CLIENT CREDENTIALS (MACHINE TO MACHINE) GRANT

      • 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

      • 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:

      • Certificate ID from OAUTH 2.0 CLIENT (M2M) SETUP

      • Private Key from the auth-key.pem file. copy the entire text including the -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- text

      • Consumer Key (Client ID) from the Netsuite integration

      • Consumer Secret (Client Secret) from the Netsuite integration

  3. 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

    4. purchase order line -- key: "ns_line_id", type: Number

  4. 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. Hit Finish and take note of the URL for the Purchasing Flow

  2. 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', 'N/log'], function(https, record, log) {

    function afterSubmit(context) {
        var newRecord = context.newRecord;
        var purchaseOrderId = newRecord.id;
        var eventType = context.type;
        
        var poData = {
            POId: purchaseOrderId,
            eventType: eventType  // 'create', 'edit', or 'delete'
        };
        
        if (eventType === 'delete') {
            // Handle deletion
            poData.message = "Delete this purchase order in ION";
        } else {
            // Handle create or edit
            var poRecord = record.load({
                type: record.Type.PURCHASE_ORDER,
                id: purchaseOrderId,
                isDynamic: true
            });
            
            poData.tranId = poRecord.getValue({ fieldId: 'tranid' });
            poData.date = poRecord.getValue({ fieldId: 'trandate' });
            poData.vendor = poRecord.getValue({ fieldId: 'entity' });
            poData.status = poRecord.getValue({ fieldId: 'status' });
        }

        log.debug("poData", poData);
      
        var payload = JSON.stringify(poData);
        
        var response = https.post({
            url: 'https://hooks.prismatic.io/trigger/SW5zdGFuY2VGbG93Q29uZmlnOjVkM2NkNWFhLWNhMmUtNDY5MC1iOWFlLTdmZmE0NzkxNzQ1MQ==', 
            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.

Close/Cancellation Functionality:

How it works: When you close a purchase order in NetSuite the corresponding purchase order in ION will be cancelled, which moves unreceived lines to unavailable.

To setup the cancellation functionality you will need to create a mass update script that will scan for closed purchase orders daily and will then run an edit/save update on each; triggering the integration to run and cancel the ION PO. Here is what that mass update will look like:

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

Token URL:

NetSuite Documentation
https://<ACCOUNT NUMBER>.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token
ION Purchases
Warning logs
2KB
NetsuitePurchasingWebhook3.js
Save this code and upload it to NetSuite when creating a Script
Hit the clipboard icon to copy this URL. You will need this in the next step
Script Creation in NetSuite
Script Deployment in NetSuite