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 3.4.0, the supplier 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.
As of version 3.9.2, all Send scripts (scripts that send from NetSuite to Logicbroker) have fine-grained control over which customers' related transactions should send to Logicbroker. These configurations are found as checkboxes on the Customer record under the Logicbroker tab. They must be checked in order for the associated script to find records associated with that customer.
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
- sendCreditMemos.js
- sendCancellationsMR.js
- pullCancelRequestsMR.js
- sendPOAcksMR.js
- exportInventoryMR.js
- exportSavedSearchInvMR.js
- populateLBPackages.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 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 DoNotShipBefore -> custbody_lb_donotshipbefore DoNotShipAfter -> custbody_lb_donotshipafter ExpectedDeliveryDate -> custbody_lb_expecteddeliverydate RequestedShipDate -> custbody_lb_requestedshipdate ReceiverCompanyId -> custbody_lbsupp_coid
Packing slip URL -> custbody_lb_packingslip
Discounts.DiscountCode -> promotions.couponcode
|
Line level field mappings (LB - NS) |
ItemIdentifier.SupplierSKU -> itemid Quantity -> quantity, custcol_lb_origqty 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 ns_customer -> entity ExtendedAttributes -> custbody_lb_headerkvps |
Hardcoded line level KVPs (LB -> NS) |
ExtendedAttributes -> custcol_lb_linekvps |
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 only if the "ns_CreateCustomer" KVP has been set on the LB order. 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. If possible, the script will attach the packing slip as a file attachment on the order in NetSuite.
An additional line-level field called
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_lborder_apikey |
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 (e.g. Nordstrom for Rufflebutts), 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. 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. To use Logicbroker Packages, configure the "Use Logicbroker Packages" checkbox under Setup -> Company -> General Preferences. The partners to send this document for can be controlled via the checkbox on the associated Customer record under the Logicbroker tab. |
Header field mappings (LB -> NS) |
ShipmentNumber -> tranid OrderNumber -> SalesOrder.tranid PartnerPO -> SalesOrder.otherrefnum BillOfLading -> custbody_lb_billoflading PRONumber -> custbody_lb_pronumber ShipToAddress -> shippingaddress BillToAddress -> SalesOrder.billingaddress ShipFromAddress -> location address LB Failed doc error msg -> custbody_lb_errormsg |
Line level field mappings (LB -> NS) |
ItemIdentifier.SupplierSKU -> custcol_lbret_itemid Description -> description LineNumber -> custcol_lb_linenum Quantity -> quantity |
ShipmentInfos mappings (LB -> NS) |
Non-LB packages: All Netsuite fields can have suffix of 'fedex', 'ups', or 'usps' depending on carrier/sublist TrackingNumber -> packagetrackingnumber (e.g. packagetrackingnumberups) ClassCode -> shipmethod (text, cleaned for special characters) Weight -> packageweight Quantity -> line.quantity (line level only)
LB packages (sublistID = recmachcustrecord_lbsupp_itemfulfillment): TrackingNumber -> custrecord_lbsupp_containertracknum Weight -> custrecord_lbsupp_containerweight Height -> custrecord_lbsupp_containerheight Width -> custrecord_lbsupp_containerwidth Length -> custrecord_lbsupp_containerlength ContainerCode -> custrecord_lbsupp_containercode ClassCode -> custrecord_lbsupp_containerclasscode ContainerType -> custrecord_lbsupp_containertype ShipmentContainerParentCode -> custrecord_lbsupp_parentcontainercode |
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. We REQUIRE our
custcol_lb_linenum field to be present in order to send the shipment. This is to avoid sending discount line items or any other lines that did not originate in Logicbroker.When using pallets, it is on the customer to create a Logicbroker package of type pallet with a Container Code, and then create Logicbroker packages of type box in which the Parent Container Code of the box matches the Container Code of the parent pallet.
|
Parameters |
custscript_lbship_apikey custscript_lbship_coid |
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 |
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.
If you want invoices to send to Logicbroker regardless of if there is an associated order in Logicbroker, configure the "Export Unlinked Invoices" checkbox in the same place mentioned above. This will ignore the existence of an Order Logicbroker Key on the Invoice and find ALL invoices in the Ready to Export status. The partners to send this document for can be controlled via the checkbox on the associated Customer record under the Logicbroker tab. |
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 Does not currently pull from LB packages 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_lbinvoice_apikey custscript_lbinvoice_coid |
sendCreditMemos.js |
|
Summary |
This script sends Credit Memos from NetSuite to Logicbroker if the credit memo has an Order Logicbroker Key and is in Logicbroker Export Status Not Exported. It will become a negative invoice in Logicbroker. |
Deployment record |
Logicbroker Send Credit Memos |
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.
If you want credit memos to send to Logicbroker regardless of if there is an associated order in Logicbroker, configure the "Export Unlinked Credit Memos" checkbox in the same place mentioned above. This will ignore the existence of an Order Logicbroker Key on the Credit Memo and find ALL credit memos in the Ready to Export status. The partners to send this document for can be controlled via the checkbox on the associated Customer record under the Logicbroker tab. |
Header level field mappings (LB -> NS) |
InvoiceNumber -> tranid InvoiceDate -> trandate HandlingAmount -> handlingcost Note -> memo InvoiceTotal -> 0 - apply_total PartnerPO -> otherrefnum Taxes[0].TaxAmount -> 0 - taxtotal Taxes[0].TaxTitle -> "Total Tax" (hardcoded) Taxes[1].TaxAmount -> 0 - tax2total Taxes[1].TaxTitle -> "Total Tax 2" (hardcoded) Discounts.DiscountAmount -> 0 - discounttotal (positive number in NS) LB Failed doc error msg -> custbody_lb_errormsg |
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 -> 0 - rate |
Hardcoded header KVP map (LB ->NS) |
ShippingCost -> shippingcost AltHandlingCost -> althandlingcost AltShippingCost -> altshippingcost CustomerMessage -> message Status -> status internalOrderId -> createdfrom 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_lbcreditmemo_apikey custscript_lbcreditmemo_coid |
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 |
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. The partners to send this document for can be controlled via the checkbox on the associated Customer record under the Logicbroker tab. |
|
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_lbcancel_apikey custscript_lbcancel_coid |
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 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. |
|
Line level field mappings (LB -> NS) |
ChangeReason -> custcol_lb_changereason (True) -> custcol_lbsupp_closedsent (True) -> isclosed |
|
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_lbcancelreq_apikey |
sendPoAcksMR.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. The partners to send this document for can be controlled via the checkbox on the associated Customer record under the Logicbroker tab. |
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_lbpoack_apikey custscript_lbpoack_coid |
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-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_lbinventory_apikey |
exportSavedSearchInvMR.js |
|
|
Summary |
This script sends configured saved searches to Logicbroker, either broadcasting or per partner. |
|
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 |
|
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. For instances where multiple accounts need to send different inventory to the same partner in LB, the script will expect the format of 'coid:search, coid:search' in the field. 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_lbssinventory_apikey custscript_lbssinventory_coid |
populateLBPackages.js |
|
Summary |
This script is not a Map/Reduce script like the others. It is an After Submit User Event script. It will run (when deployed) on Item Fulfillments that have just been moved from Packed to Shipped. More details can be found on the Logicbroker Packages help article. |
Deployment record |
Logicbroker Populate LB Packages |
Configuration requirements |
To use LB packages, you must configure the "Use Logicbroker Packages" checkbox on the Setup -> Company -> General Preferences page. Optionally, to use non-default field mappings, you can configure the deployment-level parameters listed at the bottom. |
Functionality notes |
More details can be found on the Logicbroker Packages help article. |
Parameters |
custscript_lbsupp_tracknumfield custscript_lbsupp_containercodefield custscript_lbsupp_classcodefield custscript_lbsupp_usepkgdesc |
Comments
Please sign in to leave a comment.