Retailer Flow: FIELD MAPPINGS and Detailed script functionality

In this article, the functionality of the scripts is laid out in a way that someone can determine how the script works without needing to read the code. It includes hardcoded field mappings, configuration requirements, and search criteria, as well as any other useful notes.


For a list of ALL available fields on a NetSuite transaction, use the NetSuite Records Browser (NOT Schema browser) and find the associated transaction type.


Bundle file list:

  • retHelper.js
  • sendOrdersMR.js
  • pullShipmentsMR.js
  • pullInvoicesMR.js
  • pullCancellationsMR.js
  • sendCancelRequestsMR.js





This file contains helper functions for the retailer flow. It is included in every other file in this bundle.





This script sends Purchase Orders in status Pending Receipt from NetSuite to Logicbroker if the PO is in Logicbroker Export Status Not Exported.

Deployment record

Logicbroker Send Orders

Configuration requirements

Checkbox to indicate if only drop ship POs should be sent to Logicbroker, only special orders, or both (check both boxes) under Setup -> Company -> General Preferences.

Include SO Fields on Purchase Order under Setup -> Company -> General Preferences should be checked for 3PL flows to include extra details from the Sales Order when exporting the PO.

Vendors MUST have COID set up on the Logicbroker tab.

Inbound shipment flow: Locations MUST have COID set up on them, and PO MUST have the Use Inbound Shipments checkbox checked on the Logicbroker tab.

Header field mappings

(LB -> NS)

OrderNumber                -> tranid

VendorNumber              -> otherrefnum

PartnerPO                     -> tranid

OrderDate                     -> trandate

ExpectedDeliveryDate     -> custbody_lb_expecteddeliverydate else duedate

RequestedShipDate         -> custbody_lb_requestedshipdate else shipdate

DoNotShipBefore             -> custbody_lb_donotshipbefore

DoNotShipAfter               -> custbody_lb_donotshipafter

DepartmentNumber         -> department (text)

Note                               -> message

TotalAmount                    -> total

ReceiverCompanyId         -> Vendor.custentitylb_coid

LB Failed doc error msg    -> custbody_lb_errormsg

Line level mappings

(LB -> NS)

ItemIdentifier.SupplierSKU   -> custcol_lbret_itemid

Description                         -> description

LineNumber                        -> line

Quantity                             -> quantity

Price                                   -> rate

UOM                                   -> units

Taxes.TaxAmount                 -> tax1amt

Taxes.TaxTitle                      -> "NetSuite" (hardcoded)

Address field mappings

(LB -> NS)

From shippingaddress/billingaddress subrecords:

Country                       -> country

CompanyName             -> addressee

Address1                      -> addr1

Address2                      -> addr2

City                              -> city

Zip                               -> zip

Phone                           -> addrphone

Hardcoded address KVPs are 'attention' and 'addressee'

Hardcoded header KVP map (LB ->NS)

internalOrderId              -> internalid

CreatedFrom                  -> createdfrom

NSVendorName              -> entity (text)

NSVendorId                   -> entity (value)

supervisorapproval         -> supervisorapproval

Memo                            -> memo

Division                         -> class (text)

Location                        -> location (text)

ReturnTrackingNumber   -> returntrackingnumbers

NetsuiteShipMethod       -> shipmethod (text)


If "Include SO Values on Purchase Order" is checked:

(The following fields are pulled from the associated SO)

SO_tranid                      -> tranid

SO_otherrefnum             -> otherrefnum

SO_LogicbrokerKey         -> custbody_lb_orderlbkey

SO_CustomerName         -> entity (text)

SO_shipmethod              -> shipmethod (text, cleaned for sp. characters)

SO_shipcarrier                -> shipcarrier (value)

SO_LogicbrokerClassCode -> line.custcol_lb_classcode


Inbound shipment flow mappings:

nsFromCoid                      -> Vendor COID

nsToCoid                          -> Location COID

useInboundShipments       -> true

Hardcoded line level KVP map

(LB -> NS)

itemId                           -> item

EstimatedDeliveryDate   -> expectedreceiptdate

Functionality notes

Item options will pull across as KVPs starting with “custitem”. There will likely be extra fields that just won’t be mapped.

It also takes item options over as “options_” if available. The “custitem” fields should take precedent, since “options_” won’t work for list customizations.

All custom transaction header and line level fields will come across as KVPs into Logicbroker.

If checkbox for drop ship POs is checked, only POs with a createdfrom field and at least one item with the isdropship flag will send to Logicbroker.





This script pulls shipments from Logicbroker into NetSuite based on a preconfigured pull status.

Deployment record

Logicbroker Pull Shipments

Configuration requirements

Pull from / update to status on Setup -> Company -> General Preferences page

Defaults: Pull from status 100, update to status 200.

Header level mappings

Identifier.LogicbrokerKey  -> custbody_lb_shipmentlbkey


Inbound shipment flow:

ShipmentNumber              -> externaldocumentnumber

Identifier.LogicbrokerKey    -> externalid

BillofLading                       -> billoflading

ShipmentDate                   -> expectedshippingdate

ExpectedDeliveryDate        -> expecteddeliverydate

Note                                 -> shipmentmemo

Line level field mappings

(LB -> NS)

ItemIdentifier.SupplierSKU       -> custcol_lbret_itemid

ShipmentInfos.Qty (summed)   -> quantity

ShipmentInfos.CarrierCode       -> custcol_lb_carriercode

ShipmentInfos.TrackingNumber -> custcol_lb_tracknum

ShipmentInfos.ClassCode          -> custcol_lb_classcode


Inbound shipment flow:

ShipmentInfos.Qty (summed)     -> quantityexpected

Price                                         -> expectedrate

ShipmentInfos.TrackingNumber   -> custrecord_lbret_trackingnum


Receive inbound shipment flow:

ShipmentInfos.Qty (summed)       -> quantitytobereceived

Package tab mappings

(LB -> NS)

ItemFulfillment ONLY

Maps from ShipmentLines.ShipmentInfos

Weight                -> packageweight

TrackingNumber   -> packagetrackingnumber

Hardcoded header KVP map (LB ->NS)

All header KVPs    -> custbody_lb_headerkvps


Inbound Shipment flow:

TrailerNumber       -> vesselnumber

Hardcoded line level KVP map

(LB -> NS)

All line level KVPs -> custcol_lb_linekvps


Inbound shipment flow:

lineuniquekey        -> lineuniquekey

Functionality notes

Checks for duplicates using the Shipment Logicbroker Key.

For normal flow, if the shipment has an associated Sales Order, it will create an Item Fulfillment and if only a Purchase Order exists, it will create an Item Receipt.

For Inbound Shipment flow, the shipment from the vendor will create an Inbound Shipment, and then the shipment from the location will receive the inbound shipment to create an Item Receipt. Inbound shipments pull in as "In Transit".

ALL shipments from Logicbroker flow through this script and are correctly routed to the correct type of document.

Weight is required in order for a package to be created.

WARNINGS: There may be issues in the current version if more than one Inbound Shipment is present for a single PO. Some functionality for Receive Inbound Shipment may be missing from the Item Receipt. Receive Inbound Shipment also currently has no duplicate line handling.





This script pulls invoices from Logicbroker into NetSuite as Vendor Bills based on a preconfigured pull status.

Deployment record

Logicbroker Pull Invoices

Configuration requirements

Pull from / update to status on Setup -> Company -> General Preferences page

Defaults: Pull from status 100, update to status 200.

Allow Unlinked Invoices checkbox to specify if unlinked invoices should be imported.

Header field mappings
(LB -> NS)

InvoiceNumber                -> tranid

Identifier.LogicbrokerKey  -> custbody_lb_invoicelbkey

Line level mappings
(LB -> NS)

ItemIdentifier.SupplierSKU    -> custcol_lbret_itemid

Quantity                              -> quantity

Price                                   -> rate

Hardcoded header KVP map (LB ->NS)

Only relevant for creating unlinked invoices

customform                        -> customform

Division                              -> class

All header KVPs                   -> custbody_lb_headerkvps

Hardcoded line level KVP map
(LB -> NS)

 itemId                               -> item (for additional charges)

All line level KVPs                -> custcol_lb_linekvps

Functionality notes

The Vendor Bill will transform off of the Purchase Order if it exists. If “Allow Unlinked Invoices” is checked and no linked PO is found, it will create a new Vendor Bill.

To add charges to the bill (as new line items that were not on the PO), there must be the following item-level KVP fields:
-  itemId -> The internal item ID in NetSuite
isExtraCharge -> Set to ‘T’





This script pulls acknowledgements from Logicbroker into NetSuite. If a line is fully cancelled, it will close the PO line.

Deployment record

Logicbroker Pull Cancellations

Configuration requirements

Pull from / update to status on Setup -> Company -> General Preferences page

Defaults: Pull from status 100, update to status 200.

Checkbox to allow partial line cancellations

Header level mappings
(LB -> NS)

ScheduledShipDate             -> custbody_lb_scheduledshipdate

Line level mappings
(LB -> NS)

QuantityCancelled               -> custcol_lb_cancelqty

QuantityBackordered           -> custcol_lb_backorderqty

ChangeReason                    -> custcol_lb_changereason

Functionality notes

If the company preferences checkbox configuration allows partial line cancellations, we will place the cancelled quantity in our custom line level field. It will still close out lines that have been fully cancelled.

We have a line level field custcol_lb_expectedshipdate available to act as a line level backorder date.

This does NOT create a new transaction in NetSuite.





This script sends out cancellation acknowledgements to vendors if the purchase order lines are closed, but not closed in Logicbroker

Deployment record

Logicbroker Send Cancellation Requests

Configuration requirements

Vendors must have a COID set up on the Logicbroker tab.

Header level mappings
(LB -> NS)

PartnerPO                         -> otherrefnum

AcknowledgementNumber  -> 'Ack_' + tranid + lines[0].linesequencenumber

ReceiverCompanyId           -> entity.custentitylb_coid

Line level mappings
(LB -> NS)

From 'item' sublist

ItemIdentifier.SupplierSKU   -> custcol_lbret_itemid

LineNumber                         -> linesequencenumber

Description                          -> description

Quantity                              -> 0 (hardcoded)

QuantityCancelled                -> quantity

QuantityBackordered            -> 0 (hardcoded)

ChangeReason                     -> custcol_lb_changereason

Hardcoded header KVP map (LB ->NS)


Hardcoded line level KVP map
(LB -> NS)


Functionality notes

If LB order status is Cancelled, Ignored, or Complete, the script does not send a new ack, it just marks the lines as exported.

There is a custom change reason line-level column that will populate if available.

Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.

Didn't find what you were looking for?

Submit a request