Sync Netsuite Orders via Custom Hook
Updated over a week ago

The Shippit + NetSuite bundle offers merchants the ability to sync orders and fulfillments between the NetSuite platform and Shippit.

Within the bundle, we have functionality that enables merchants to manually trigger the sync of an order or fulfilment from NetSuite with the Shippit platform. This feature is provided by default out of the box as part of the standard installation.

In some cases, merchants may wish to implement their own custom logic to trigger one, or multiple orders or fulfillments from NetSuite, to be synced with Shippit.

The Shippit NetSuite bundle “API SuiteLet” can be utilised in these cases, enabling you to control when and what orders/fulfillments from NetSuite are sent to Shippit.

Developer Documentation

The following documentation assumes working knowledge of the NetSuite system, specifically, working with NetSuite Objects and SuiteScript v1.0.Documentation relating to SuiteScript v1.0 is available at https://docs.oracle.com/cloud/latest/netsuitecs_gs/NSSDR/NSSDR.pdf

Shippit NetSuite Bundle — The “API” SuiteLet

Within the Shippit Bundle, we expose a custom SuiteScript SuiteLet that enables the ability to trigger syncing one or more orders/fulfillments from NetSuite with the Shippit platform.

What is a NetSuite SuiteLet?

The following passage describes SuiteLets, as documented in the SuiteScript v1.0 Developer & Reference Guide (Page 33)

SuiteLets are extensions of the SuiteScript API that give developers the ability to build custom NetSuite pages and backend logic. SuiteLets are server-side scripts that operate in a request-response model. They are invoked by HTTP GET or POST requests to system generated URLs.

The Shippit API SuiteLet, specifically referred to within the Bundle as `customscript_shippit_api` is available to be called upon to trigger sync actions against one or more orders or fulfillments in NetSuite.

How can I use the SuiteLet to send orders to Shippit?

At a high level, the following would be required in your implementation to consume the SuiteLet to send order(s) to Shippit.

  1. Use the below identifier to obtain the SuiteLet URL:

    nlapiResolveURL
  2. Supply the required parameters for the request

  3. Process the returned results

Example Implementation

var ids = [1, 2, 3];
var url = nlapiResolveURL('SUITELET', 'customscript_shippit_api', 'customdeploy_shippit_api');
url += '&recordType=salesorder&ids=' + ids.join();

Where..

  • Line 1 - Collect the internalIds that are to be synced with Shippit (ie: Orders with InternalID 1, 2 and 3)

  • Line 2 - Dynamically retrieve the URL of the SuiteLet, by calling for the SuiteLet with id customscript_shippit_api

  • Line 3 - Append a comma separated list of orders to the SuiteScript URL

Need to send a large amount of orders?

The SuiteLet endpoint supports both HTTP GET and HTTP POST requests. If you have a large amount of potential orders being sent, we suggest communicating with a HTTP POST request, placing the ids payload in the HTTP BODY of the HTTP POST request.

Responsibilities of the SuiteLet Endpoint

The SuiteLet endpoint will process the request and communicate with our Shippit Connect platform, initiating a request to trigger a retrieval of the order or fulfillments ids provided.

The SuiteLet enables you to simply initiate requests to sync orders/fulfillments with Shippit, with the SuiteLet then managing the authentication and communication with our Shippit Connect platform.

The request to trigger the retrieval of these items will be actioned immediately, with a response provided to indicate success or failure of the request — however the processing of the order/fulfillment ids requested to be gathered and and sent to Shippit will occur asynchronously in the background, and will typically require 10~30 seconds for the synced items to appear within Shippit.

SuiteLet Request Specification

The Shippit API SuiteLet accepts the following request parameters…

Parameter

Description

Default

Example

ids

A comma separated list of order or fulfillment ids to be sent to Shippit

1,2,3

recordType

The type of record that the ids refer to

Either salesorder or itemfulfillment is accepted

salesOrder

Example — Sending Orders to Shippit

https://${SUITELET_ENDPOINT_URL}?ids=1,2,3,4&recordType=salesorder

Example — Sending ItemFulfillments to Shippit

https://${SUITELET_ENDPOINT_URL}?ids=5,6,7,8&recordType=itemfulfillment
Did this answer your question?