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

  • suppHelper.js
  • pullOrdersMR.js
  • sendShipmentsMR.js
  • sendInvoicesMR.js
  • sendCancellationsMR.js
  • pullCancelRequestsMR.js
  • exportInventoryMR.js
  • exportSavedSearchInvMR.js

 

suppHelper.js

 

Summary

This file contains helper functions for the supplier flow and is where the company level parameters are created/used. It is included in every other file in this bundle.

 

 

pullOrdersMR.js

 

Summary

This script pulls orders from Logicbroker into NetSuite as Sales Orders based on a preconfigured pull status.

Deployment record

Logicbroker Pull Orders

Configuration requirements

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

Defaults: Pull from status 100, update to status 200

Header field mappings
(LB -> NS)

PartnerPO                 -> otherrefnum

BillToAddress.Email    -> email

Line level field mappings

(LB - NS)

ItemIdentifier.SupplierSKU    -> itemid

Quantity                              -> quantity

LineNumber                         -> custcol_lb_linenum

Address field mappings

(LB -> NS)

Country                       -> country (defaults to 'US')

CompanyName             -> attention

FirstName + LastName  -> addressee

Address1                      -> addr1

Address2                      -> addr2

City                              -> city

Zip                               -> zip

Phone                           -> addrphone

Hardcoded header KVP map (LB ->NS)

customform              -> customform

shiprate                    -> shipgroup sublist shippingrate

Division                    -> class

Functionality notes

NetSuite checks for duplicates using the custom Order Logicbroker Key field.

Other header/line/address level KVPs can be added using “netsuite_” prefix on LB order

To send a Boolean KVP, use Section: Boolean and a value beginning with a t or f

To send a Date KVP, use Section: Date in the LB document’s KVP

Looks for customer using custom COID field on Customer record, then by name if no match. If no customer is found, it will create a new one.

If "ismultishipto" field is set on the Netsuite SO form, we will set the line level ship to information, and use the "shiprate" headerKVP to populate the "shippingrate" field on the "shipgroup" sublist.

 

sendShipmentsMR.js

 

Summary

This script sends Item Fulfillments from NetSuite to Logicbroker if the fulfillment has an Order Logicbroker Key and is in Logicbroker Export Status Not Exported.

Deployment record

Logicbroker Send Shipments

Configuration requirements

If certain trading partners need to be excluded from send shipments, you can configure the internal IDs of the customer records to be excluded using the Exclude Customers from Send Shipments field on the Setup -> Company -> General Preferences page

Header field mappings

(LB -> NS)

ShipmentNumber    -> tranid

OrderNumber          -> SalesOrder.tranid

PartnerPO               -> SalesOrder.otherrefnum

Line level field mappings

(LB -> NS)

ItemIdentifier.SupplierSKU   -> custcol_lbret_itemid

Description                         -> description

LineNumber                        -> custcol_lb_linenum

Quantity                             -> quantity

ShipmentInfos mappings

(LB -> NS)

All Netsuite fields can have suffix of 'fedex', 'ups', or 'usps' depending on carrier/sublist

Note: a package with a tracking number is required for the script to pull the itemfulfillment out of netsuite. 

TrackingNumber       -> packagetrackingnumber (e.g. packagetrackingnumberups)

ClassCode                -> shipmethod (text, cleaned for special characters)

Weight                     -> packageweight

Quantity                   -> line.quantity (line level only)

ShipTo Address mappings

(LB -> NS)

From shippingaddress subrecord

Country                       -> country

CompanyName             -> addressee

Address1                      -> addr1

Address2                      -> addr2

City                              -> city

Zip                               -> zip

Phone                           -> addrphone

 

Hardcoded address KVPs are 'attention' and 'addressee'

BillTo/ShipFrom mappings

(LB -> NS

From SalesOrder.billingAddress and Location.address searches

Country                       -> countrycode

CompanyName             -> addressee

Address1                      -> address1

Address2                      -> address2

City                              -> city

Zip                               -> zip

Phone                           -> phone

 

Hardcoded address KVPs are 'attention' and 'addressee'

Hardcoded header KVP map (LB -> NS)

internalOrderId        -> SalesOrder.internalid

internalShipmentId   -> internalid

Functionality notes

If only one package, tracking info will be on the line level. If multiple packages, it will be at the header level ShipmentInfos.

Gets Ship From address from item level location.

Gets Bill To address from the associated Sales Order's billing address.

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

 

 

sendInvoicesMR.js

 

Summary

This script sends Invoices from NetSuite to Logicbroker if the invoice has an Order Logicbroker Key and is in Logicbroker Export Status Not Exported.

Deployment record

Logicbroker Send Invoices

Configuration requirements

 

Header level field mappings

(LB -> NS)

InvoiceNumber       -> tranid

InvoiceDate            -> trandate

HandlingAmount     -> handlingcost

Note                      -> memo

InvoiceTotal            -> total

OrderNumber          -> SalesOrder.tranid

PartnerPO               -> SalesOrder.otherrefnum

Taxes.TaxAmount    -> taxtotal

Taxes.TaxTitle         -> "Total Tax" (hardcoded)

PaymentTerm.TermsDescription   -> terms (text)

PaymentTerm.DueDate               -> duedate

PaymentTerm.DiscountDueDate   -> discountdate

Discounts.DiscountAmount          -> 0 - discounttotal (positive number in NS)

ShipmentInfos mappings

(LB -> NS)

Pulled from ItemFulfillment on join shipmentPackage search

TrackingNumber       -> shipmentPackage.trackingnumber

ClassCode                -> shipmethod (text, cleaned for special characters)

Weight                     -> shipmentPackage.weightinlbs

BillTo/ShipTo mappings

(LB -> NS)

Country                       -> country

CompanyName             -> addressee

Address1                      -> addr1

Address2                      -> addr2

City                              -> city

Zip                               -> zip

Phone                           -> addrphone

 

Hardcoded address KVPs are 'attention' and 'addressee'

Line level field mappings

(LB -> NS)

From 'item' sublist

ItemIdentifier.SupplierSKU   -> custcol_lbret_itemid

ItemIdentifier.UPC               -> upccode (if available)

LineNumber                         -> custcol_lb_linenum

Description                          -> description

Quantity                              -> quantity

Price                                   -> rate

Cost                                    -> cost

Hardcoded header KVP map (LB ->NS)

ShippingCost          -> shippingcost

AltHandlingCost     -> althandlingcost

AltShippingCost      -> altshippingcost

CustomerMessage   -> message

Status                    -> status

internalOrderId        -> SalesOrder.internalid

internalInvoiceId      -> internalid

Hardcoded line level KVPs

(LB -> NS)

itemType    -> item.itemtype

Functionality notes

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

 

sendCancellationsMR.js

 

Summary

This script looks for closed SO lines that have not been exported to Logicbroker yet, and exports them as Acks grouped by transaction.

Deployment record

Logicbroker Send Cancellations

Configuration requirements

 

Header field mappings

(LB -> NS)

PartnerPO        -> otherrefnum

AcknowledgementNumber: 'Ack_' + tranid + lines[0].linesequencenumber

Line level field 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)

 

Functionality notes

Looks for closed SO lines with unchecked LB Closed checkbox (custcol_lbsupp_closedsent).

Checks this checkbox once export has completed.

Adds a custom line level field for LB Change Reason which will export on the Ack.

First checks LB for order status. If Cancelled, Ignored, or Complete, it marks the ack as sent without actually exporting.

 

 

pullCancelRequestsMR.js

 

Summary

This script pulls all acknowledgements from Logicbroker in a preconfigured pull status, and closes the corresponding lines on the Sales Order.

Deployment record

Logicbroker Pull Cancellation Requests

Configuration requirements

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

Defaults: Pull from status 100, update to status 200

Hardcoded header KVP map (LB ->NS)

 

Functionality notes

If SO is already closed or ack has no cancelled lines, the script changes nothing in NetSuite, just updates the ack status in Logicbroker (configurable).

This does NOT create any new transaction in Netsuite. It only marks lines as closed on the Sales Order.

 

 

exportInventoryMR.js

 

Summary

This script finds ALL Inventory Items and broadcasts them via the Logicbroker API endpoint. It uses the default NetSuite functionality.

Deployment record

Logicbroker Export Inventory

Configuration requirements

 

Field mappings (LB ->NS)

These are all Item fields

SupplierSKU              -> itemid

UPC                          -> upccode

Quantity                   -> sum of all locationquantityavailable fields

Cost                         -> cost

Description               -> salesdescription

Weight                     -> weight

Warehouse               -> inventorylocation (text)

WarehouseQuantity   -> locationquantityavailable

 

Functionality notes

The script separates out warehouse quantities up to 5 warehouses.

It saves the file to a folder in NetSuite called "lbtmpFolder" and creates a file called "logicbrokerInventory" + Date.now() + ".csv". These are deleted when the export is finished.

All rows are "sanitized", meaning if a column contains a comma, carriage return, or double quotes, the double quotes are changed to "" and the column is encompassed by \" characters.

 

 

exportSavedSearchInvMR.js

 

Summary

This script sends configured saved searches to Logicbroker, either broadcasting or per partner.

Deployment record

Logicbroker Export Saved Search Inv

Configuration requirements

For BROADCASTING:

Inventory Saved Search IDs field has Saved Search IDs and the Broadcast Inventory checkbox is checked off in Setup -> Company -> General Preferences

Set up a template to convert the saved search columns to Logicbroker’s format

 

For SENDING PER PARTNER:

Broadcast Inventory checkbox is unchecked in Setup -> Company -> General Preferences

Saved Search IDs are set up on the Logicbroker tab of Customer Records for the trading partners who should receive inventory. 

Set up a template to convert the saved search columns to Logicbroker’s format

Hardcoded header KVP map (LB ->NS)

 

Functionality notes

The IDs should be space or comma separated values. Include IDs for all inventory-related Saved Searches that should be exported to Logicbroker.

When sending to Logicbroker, the transform parameter is set to true.

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

Comments

0 comments

Please sign in to leave a comment.

Didn't find what you were looking for?

Submit a request