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.
As of version 2.1.0, the Commerce EDI bundle supports multiple LB connections to one NetSuite account. More details can be found in the Connecting Multiple Logicbroker Accounts help article. Parameters for this usage are documented below.
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:
- 3plHelper.js
- pullOrders3pl.js
- sendFulfillmentReqs.js
- sendTransferOrders.js
- pull3plShipments.js
- pullCancels3pl.js
- pullCancelRequests3pl.js
- sendCancellations3pl.js
- sendInvoices3pl.js
- sendPoAcks.js
- exportInventory3pl.js
- exportSavedSearchInv3pl.js
3plHelper.js |
|
Summary |
This file contains helper functions for the 3PL flow and is where the company level parameters are created/used. It is included in every other file in this bundle. |
pullOrders3pl.js |
|
Summary |
This script pulls orders from Logicbroker into NetSuite as Sales Orders based on a preconfigured pull status. It is identical to the pull orders script in the supplier flow, except it uses the 3pl helper file. |
Deployment record |
Logicbroker Pull Orders (3PL) |
Configuration requirements |
Pull from / update to status on Setup -> Company -> General Preferences page Defaults: Pull from status 100, update to status 200 If connecting to multiple LB accounts, you must configure the "Connect multiple LB accounts" checkbox on the Setup -> Company -> General Preferences page and then configure the parameters (listed at the bottom of this table) on the script deployment page. There must be one deployment per Logicbroker connection. |
Header field mappings |
PartnerPO -> otherrefnum BillToAddress.Email -> email SenderCompanyId -> custbody_lb3pl_sendercoid
ReceiverCompanyId -> custbody_lb3pl_receivercoid
DoNotShipBefore -> custbody_lb_donotshipbefore DoNotShipAfter -> custbody_lb_donotshipafter ExpectedDeliveryDate -> custbody_lb_expecteddeliverydate RequestedShipDate -> custbody_lb_requestedshipdate Discounts.DiscountCode -> promotions.couponcode |
Line level field mappings (LB - NS) |
ItemIdentifier.SupplierSKU -> itemid Quantity -> quantity and custcol_lb_origqty LineNumber -> custcol_lb_linenum ShipmentInfos.ClassCode (or header version if this is empty) -> custcol_lb_classcode |
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 ns_customer -> entity |
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.
An additional line-level field called custcol_lb_expectedshipdate is available on the SO. You can set this field using a KVP "netsuite_custcol_lb_expectedshipdate".
If you need to set the customer manually in NetSuite, you CANNOT use
For promotions, at least one of the following features must be enabled: ADVANCEDPROMOTIONS, STACKABLEPROMOTIONS, PROMOCODES. |
Parameters |
custscript_lb3plorder_apikey |
sendFulfillmentReqs.js |
|
Summary |
This script sends Fulfillment Requests from NetSuite to Logicbroker if the request has an Order Logicbroker Key and is in Logicbroker Export Status Not Exported. |
Deployment record |
Logicbroker Send Fulfillment Requests |
Configuration requirements |
In order to use this script, you must check the Use Fulfillment Requests field on the Setup -> Company -> General Preferences page. In addition, any 3PL locations must have the Logicbroker COID configured on the corresponding Location record in NetSuite. If connecting to multiple LB accounts, you must configure the "Connect multiple LB accounts" checkbox on the Setup -> Company -> General Preferences page and then configure the parameters (listed at the bottom of this table) on the script deployment page. There must be one deployment per Logicbroker connection. |
Header field mappings (LB -> NS) |
OrderNumber -> tranid PartnerPO -> tranid OrderDate -> trandate RequestedShipDate -> SalesOrder.shipdate DepartmentNumber -> SalesOrder.department Taxes.TaxAmount -> SalesOrder.taxtotal PaymentTerm.TermsDescription -> SalesOrder.terms BillToAddress -> SalesOrder.billingaddress ShipToAddress -> SalesOrder.shippingaddress DoNotShipBefore -> SalesOrder.custbody_lb_donotshipbefore DoNotShipAfter -> SalesOrder.custbody_lb_donotshipafter ExpectedDeliveryDate -> SalesOrder.custbody_lb_expecteddeliverydate RequestedShipDate -> SalesOrder.custbody_lb_requestedshipdate ReceiverCompanyId -> location.custrecord_lb3pl_coid |
Line level field mappings (LB -> NS) |
ItemIdentifier.SupplierSKU -> custcol_lbret_itemid Description -> description LineNumber -> line Quantity -> quantity Price -> SalesOrder.rate UOM -> units (text) |
ShipmentInfos mappings (LB -> NS) |
ClassCode -> shipmethod (text, cleaned for special characters) |
ShipTo/BillTo Address mappings (LB -> NS) |
From SalesOrder.shippingaddress and SalesOrder.billingaddress searches 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) |
isFftReq -> true internalOrderId -> internalid CreatedFrom -> createdfrom SO_tranid -> SalesOrder.tranid SO_otherrefnum -> SalesOrder.otherrefnum (the PartnerPO of order) SO_shipdate -> SalesOrder.shipdate Memo -> memo Division -> SalesOrder.class (text) Location -> location (text) LocationId -> location NetsuiteShipMethod -> SalesOrder.shipmethod OriginalPartnerCoId -> SalesOrder.custbody_lb3pl_receivercoid OriginalCoId -> SalesOrder.custbody_lb3pl_sendercoid SO_LogicbrokerHeaderData -> SalesOrder.custbody_lb_headerdata
|
Hardcoded line level KVPs (LB -> NS) |
itemId -> itemid SO_line -> SalesOrder.line SO_LogicbrokerClassCode -> SalesOrder.custcol_lb_classcode
SO_LogicbrokerLineNumber -> SalesOrder.custcol_lb_linenum
SO_LogicbrokerLineData -> SalesOrder.custcol_lb_linedata
lineuniquekey -> lineuniquekey
|
Functionality notes |
All custom transaction header and line level fields will come across as KVPs into Logicbroker. Many of the fields on this document come from the related Sales Order. When a mapping begins with "SalesOrder." it is referring to the transaction in the createdfrom field. Any item options should come across to Logicbroker as KVPs beginning with options_ |
Parameters |
custscript_lb3plfftreq_apikey custscript_lb3plfftreq_coid |
sendTransferOrders.js |
|
Summary |
This script sends Transfer Orders from NetSuite to Logicbroker if the TO is in Logicbroker Export Status Not Exported. |
Deployment record |
Logicbroker Send Transfer Orders |
Configuration requirements |
To and From locations MUST have COID set up on them (custrecord_lb3pl_coid)
If connecting to multiple LB accounts, you must configure the "Connect multiple LB accounts" checkbox on the Setup -> Company -> General Preferences page and then configure the parameters (listed at the bottom of this table) on the script deployment page. There must be one deployment per Logicbroker connection. |
Header field mappings (LB -> NS) |
OrderNumber -> tranid PartnerPO -> tranid OrderDate -> trandate ExpectedDeliveryDate -> custbody_lb_expecteddeliverydate else duedate RequestedShipDate -> custbody_lb_requestedshipdate else shipdate DoNotShipBefore -> custbody_lb_donotshipbefore DoNotShipAfter -> custbody_lb_donotshipafter TotalAmount -> total LB Failed doc error msg -> custbody_lb_errormsg |
Line level mappings (LB -> NS) |
ItemIdentifier.SupplierSKU -> custcol_lbret_itemid Description -> description LineNumber -> line Quantity -> quantity UOM -> units |
Address field 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' |
Hardcoded header KVP map (LB ->NS) |
isTranOrd -> "True" nsFromCoid -> location.custrecord_lb3pl_coid nsToCoid -> transferlocation.custrecord_lb3pl_coid internalOrderId -> internalid Memo -> memo Location -> location (text) LocationId -> location (value) TransferLocation -> transferlocation (text) TransferLocationId -> transferlocation (value) NetsuiteShipMethod -> shipmethod NetsuiteShipCarrier -> shipcarrier |
Hardcoded line level KVP map (LB -> NS) |
itemId -> item lineuniquekey -> lineuniquekey EstimatedDeliveryDate -> expectedreceiptdate |
Functionality notes |
All custom transaction header and line level fields will come across as KVPs into Logicbroker.
An additional line-level field called custcol_lb_expectedshipdate is available on the TO. You can set this field using a KVP "netsuite_custcol_lb_expectedshipdate". |
Parameters |
custscript_lb3pltranord_apikey custscript_lb3pltranord_coid |
pull3plShipments.js |
|
Summary |
This script pulls shipments from Logicbroker into NetSuite based on a preconfigured pull status. |
Deployment record |
Logicbroker Pull 3PL Shipments |
Configuration requirements |
Pull from / update to status on Setup -> Company -> General Preferences page Defaults: Pull from status 100, update to status 200. Retailer API key if using Fulfillment Requests (This would be the "retailer" version of the supplier)
If connecting to multiple LB accounts, you must configure the "Connect multiple LB accounts" checkbox on the Setup -> Company -> General Preferences page and then configure the parameters (listed at the bottom of this table) on the script deployment page. There must be one deployment per Logicbroker connection. |
Header level mappings |
Identifier.LogicbrokerKey -> custbody_lb_shipmentlbkey |
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 ShipmentInfos -> custcol_lb_shipinfos |
Package tab mappings (LB -> NS) |
Maps from ShipmentLines.ShipmentInfos Weight -> packageweight TrackingNumber -> packagetrackingnumber |
Hardcoded header KVP map (LB ->NS) |
isFftReq -> true CreatedFrom -> SalesOrder.internalid |
Hardcoded line level KVP map (LB -> NS) |
ns_serialnumbers -> inventorydetail.issueinventorynumber |
Functionality notes |
Checks for duplicates using the Shipment Logicbroker Key. All packages will pull into the generic package list. Weight is required in order for a package to be created. If "Use Fulfillment Requests" is configured, it will use the retailer API key to pull shipments. Otherwise, it will use the normal (supplier) API key. This allows the script to work for customers who are not using fulfillment requests.
|
Parameters |
custscript_lb3plship_apikey |
pullCancels3pl.js |
|
Summary |
This script pulls acknowledgements from the 3PL in Logicbroker into NetSuite using the Retailer API Key and creates exceptions on the lines of the Fulfillment Request. |
Deployment record |
Logicbroker Pull 3PL Cancellations |
Configuration requirements |
Pull from / update to status on Setup -> Company -> General Preferences page Defaults: Pull from status 100, update to status 200. In order to use this script, you must check the Use Fulfillment Requests field on the Setup -> Company -> General Preferences page. Before using this script, you must have created a "Fulfillment Exception Reason" under Setup -> Order Management -> Fulfillment Exception Reasons -> New. Make it type "Picking". I recommend calling it "Logicbroker Exception Reason".
If connecting to multiple LB accounts, you must configure the "Connect multiple LB accounts" checkbox on the Setup -> Company -> General Preferences page and then configure the parameters (listed at the bottom of this table) on the script deployment page. There must be one deployment per Logicbroker connection. |
Hardcoded header KVP map (LB ->NS) |
|
Line level exception mapping (LB -> NS) |
NetSuite fields are on the fulfillmentexception sublist QuantityCancelled -> exceptionquantity 1 (Picking, hardcoded for now) -> exceptiontype ExtendedAttributes.nsExceptionId -> exceptionreason ChangeReason -> exceptioncomments |
Functionality notes |
This does NOT create a new transaction in Netsuite. Netsuite has no notion of acknowledgements. The Exception Reason internal ID needs to be in a KVP called nsExceptionId. The reason code from the line level will be used as comments for the exception. This could unfortunately not be added to the bundle. For now, it must be a picking exception. If we find that we need control over the type of exception, it can be made configurable. This script ONLY creates an exception as of right now. It does not reject the line on the Fulfillment Request, nor does it cancel the line on the Sales Order. In this way, the client can review, create a new fulfillment, or create some kind of automation to run off of the exception. |
Parameters |
custscript_lb3plpullcancel_apikey |
sendCancellations3pl.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. It is identical to the version in the Supplier bundle, except it uses the 3pl Helper file. This will happen whenever a new line or sales order is closed, so be aware that multiple acknowledgements may be sent to Logicbroker if things are cancelled at different times. |
Deployment record |
Logicbroker Send Cancellations |
Configuration requirements |
If connecting to multiple LB accounts, you must configure the "Connect multiple LB accounts" checkbox on the Setup -> Company -> General Preferences page and then configure the parameters (listed at the bottom of this table) on the script deployment page. There must be one deployment per Logicbroker connection. |
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. |
Parameters |
custscript_lb3plcancel_apikey custscript_lb3plcancel_coid |
pullCancelRequests3pl.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
If connecting to multiple LB accounts, you must configure the "Connect multiple LB accounts" checkbox on the Setup -> Company -> General Preferences page and then configure the parameters (listed at the bottom of this table) on the script deployment page. There must be one deployment per Logicbroker connection. |
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. |
Parameters |
custscript_lb3plcancelreq_apikey
|
sendInvoices3pl.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. It is identical to the version in the Supplier bundle, except it uses the 3pl Helper file. |
Deployment record |
Logicbroker Send Invoices (3PL) |
Configuration requirements |
If connecting to multiple LB accounts, you must configure the "Connect multiple LB accounts" checkbox on the Setup -> Company -> General Preferences page and then configure the parameters (listed at the bottom of this table) on the script deployment page. There must be one deployment per Logicbroker connection. |
Header level field mappings (LB -> NS) |
InvoiceNumber -> tranid InvoiceDate -> trandate HandlingAmount -> handlingcost Note -> memo InvoiceTotal -> total OrderNumber -> SalesOrder.tranid PartnerPO -> SalesOrder.otherrefnum Taxes[0].TaxAmount -> taxtotal Taxes[0].TaxTitle -> "Total Tax" (hardcoded) Taxes[1].TaxAmount -> tax2total Taxes[1].TaxTitle -> "Total Tax 2" (hardcoded) PaymentTerm.TermsDescription -> terms (text) PaymentTerm.DueDate -> duedate PaymentTerm.DiscountDueDate -> discountdate Discounts.DiscountAmount -> 0 - discounttotal (positive number in NS) LB Failed doc error msg -> custbody_lb_errormsg |
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 QuantityUOM -> units_display 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. |
Parameters |
custscript_lb3plinvoice_apikey
custscript_lb3plinvoice_coid
|
sendPoAcks.js |
|
Summary |
This script looks for Sales Orders with an Acknowledgement Export Status of Not Exported, and exports their lines as Acknowledgements to Logicbroker. |
Deployment record |
Logicbroker Send PO Acks |
Configuration requirements |
If connecting to multiple LB accounts, you must configure the "Connect multiple LB accounts" checkbox on the Setup -> Company -> General Preferences page and then configure the parameters (listed at the bottom of this table) on the script deployment page. There must be one deployment per Logicbroker connection. |
Header field mappings (LB -> NS) |
PartnerPO -> otherrefnum AcknowledgementNumber -> 'Ack_' + tranid LB Failed doc error msg -> custbody_lb_errormsg |
Hardcoded header KVPs (LB -> NS) |
shipdate -> shipdate
ScheduledShipDate -> custbody_lb_scheduledshipdate
ScheduledDeliveryDate -> custbody_lb_scheduleddeliverydate
|
Line level field mappings (LB -> NS) |
From 'item' sublist ItemIdentifier.SupplierSKU -> custcol_lbret_itemid LineNumber -> custcol_lb_linenum Description -> description Quantity -> quantity - quantitybackordered QuantityCancelled -> custcol_lb_origqty - quantity QuantityBackordered -> quantitybackordered ChangeReason -> custcol_lb_changereason |
Hardcoded line level KVPs (LB ->NS) |
ExpectedShipDate -> expectedshipdate ScheduledShipDate -> custcol_lb_scheduledshipdate
ScheduledDeliveryDate -> custcol_lb_scheduleddeliverydate
ns_rate -> rate
|
Functionality notes |
Adds a custom line level field for LB Change Reason which will export on the Ack. It defaults to blank, unless at least one qty is backordered or cancelled, then it will default to Other. Adds a custom line field for the original quantity on the order. This is necessary for the quantity calculations. The Acknowledgement Export Status (custbody_lb_ackexportstatus) will default to no value. It can be automatically set to Not Exported via business rules (set a KVP with netsuite_custbody_lb_ackexportstatus and a value of 3) in order to "auto acknowledge" as soon as the order gets imported into NetSuite. For other functionality, the customer should configure a workflow or script in NetSuite to set the value of the field at the right time in their order lifecycle. |
Parameters |
custscript_lb3plpoack_apikey custscript_lb3plpoack_coid |
exportInventory3pl.js |
|
Summary |
This script finds ALL Inventory Items and broadcasts them via the Logicbroker API endpoint. It uses the default NetSuite functionality. It is identical to the version in the Supplier bundle, except it uses the 3pl Helper file. |
Deployment record |
Logicbroker Export Inventory-Deprecated |
Configuration requirements |
If connecting to multiple LB accounts, you must configure the "Connect multiple LB accounts" checkbox on the Setup -> Company -> General Preferences page and then configure the parameters (listed at the bottom of this table) on the script deployment page. There must be one deployment per Logicbroker connection. |
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. |
Parameters |
custscript_lb3plinventory_apikey
|
exportSavedSearchInv3pl.js |
|
Summary |
This script sends configured saved searches to Logicbroker, either broadcasting or per partner. It is identical to the version in the Supplier bundle, except it uses the 3pl Helper file. |
Deployment record |
Logicbroker Export Inventory |
Configuration requirements |
For BROADCASTING: Inventory Saved Search IDs field has Saved Search IDs, Inventory CSV File IDs contains internal file IDs of CSV files 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 and CSV file 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
If connecting to multiple LB accounts, you must configure the "Connect multiple LB accounts" checkbox on the Setup -> Company -> General Preferences page and then configure the parameters (listed at the bottom of this table) on the script deployment page. There must be one deployment per Logicbroker connection. |
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. This script will handle BOTH saved searches and CSV files. It is not either/or. So if a customer record has a saved search ID and a CSV file ID on it, BOTH will export to LB. |
Parameters |
custscript_lb3plssinventory_apikey
custscript_lb3plssinventory_coid
|
Comments
Please sign in to leave a comment.