Skip to main content

Generated page. Written from IdaMilk/SuiteScripts at commit 1f253e6 on 2026-07-28. The repository has no README, so everything below is inferred from source — the script headers are unusually good, but business context is inferred. Corrections belong in the repository.

SuiteScripts

What is it?

A flat collection of standalone SuiteScript 2.x customisations deployed into NetSuite. Fourteen JavaScript files and two HTML print templates, grouped loosely by folder, covering invoice creation, inventory counting and reconciliation, and Bill of Lading / Certificate of Analysis printing.

This is not an application — it is a drawer of individual scripts, each deployed separately in NetSuite.

Purpose

These scripts automate work that would otherwise be done by hand in the NetSuite UI: transcribing lot numbers onto invoices, reconciling pallet detail against on-hand inventory, processing scanned bin counts, and producing shipping and quality documents.

The invoicing script's header is explicit about the motive — it stamps lots onto billed lines "like accounting does by hand".

How it Works

There is no shared runtime. Each file is deployed independently in NetSuite and triggered by its own mechanism, which the @NScriptType header declares.

Three broad patterns appear:

Called from outside NetSuite. The Restlets (createInvoiceFromSO.js, Inventory Count/countTrigger.js, Inventory Count/countCheckStatus.js) are entry points invoked by the SunApps platform. countTrigger accepts a bin ID and a list of scanned pallet IDs, schedules the Map/Reduce job, and returns a task ID; countCheckStatus then polls that task ID for PENDING / PROCESSING / COMPLETE / FAILED. That split exists because Map/Reduce is asynchronous — the caller cannot block on it.

Bulk record processing. The Map/Reduce scripts do the heavy work. Inventory Sync/palletSync.js sums available pallet-detail quantities per item and lot, compares the total to NetSuite's on-hand figure, and posts a single Inventory Adjustment for any delta. inventoryBinReset.js strips bin associations from lot-numbered items through a deliberate four-step sequence — enable bins, zero the lots out of them, disable bins, restore the lots without bin context — and logs distinct failure states (STEP1_FAILED, STEP2_FAILED, STEP3_FAILED) at each stage so a half-finished run can be recovered manually.

Print buttons. BoL and CoA printing each use the same three-part pattern: a User Event script (printBoLButton.js) adds a button to the record's view form and attaches a Client Script; the Client Script (printBoLExpose.js) resolves the Suitelet URL and opens it in a new tab; the Suitelet (printBoLSuitelet.js) gathers the data and renders the HTML template.

Core Features

FeaturePurpose
Invoice from Sales OrderTransforms an SO to an invoice, stamping exact lots and quantities from verified pallet details onto each billed line
Bin inventory countProcesses scanned pallets against a bin and posts the resulting adjustment
Pallet syncReconciles pallet detail quantities against NetSuite on-hand and adjusts the difference
Bin resetRemoves bin associations from lot-numbered items, with staged recovery points
Inventory consolidationMoves on-hand inventory between subsidiaries via Intercompany Transfer Orders
Bill of Lading printingAdds a Print BOL button that renders a BoL from an HTML template
Certificate of Analysis printingAdds a Generate COA button that renders quality results from an HTML template

Script inventory

FileScript typeTrigger
createInvoiceFromSO.jsRestletCalled externally
Inventory Count/countTrigger.jsRestletCalled externally
Inventory Count/countCheckStatus.jsRestletCalled externally (polling)
Inventory Count/countMapReduce.jsMapReduceScriptScheduled by countTrigger
Inventory Sync/palletSync.jsMapReduceScriptNot determinable from source
inventoryBinReset.jsMapReduceScriptNot determinable from source
inventoryConsolidationMR.jsMapReduceScriptNot determinable from source
inventoryTransferTest2.jsScheduledScriptManual — test script
Print BoL/printBoLButton.jsUserEventScriptbeforeLoad on view
Print BoL/printBoLExpose.jsClientScriptButton click
Print BoL/printBoLSuitelet.jsSuiteletGET from client script
Print CoA/printCoAButton.jsUserEventScriptbeforeLoad on view
Print CoA/printCoAExpose.jsClientScriptButton click
Print CoA/printCoASuitelet.jsSuiteletGET from client script

Deployment records are not in this repository, so the NetSuite deployment ID and schedule for each script cannot be confirmed here.

Known deployment identifiers

Only two script IDs are hardcoded in source:

ScriptScript IDDeployment ID
BoL Suiteletcustomscript5304customdeploy1
CoA Suiteletcustomscript5763customdeploy1

Configuration constants

Several Map/Reduce scripts carry hardcoded NetSuite internal IDs at the top of the file rather than script parameters:

ConstantValueAppears in
LOCATION_ID23palletSync.js, inventoryBinReset.js
SUBSIDIARY_ID2palletSync.js, inventoryBinReset.js
ADJUSTMENT_ACCOUNT_ID476palletSync.js, inventoryBinReset.js
INVENTORY_STATUS_ID1 ("Good")palletSync.js
ACTIVE_STATUSES[1, 3, 4, 12]palletSync.js

countMapReduce.js is the exception — it reads custscript_inventory_count_bin_id and custscript_inventory_count_pallets as script parameters.

Caveats worth knowing

These are visible in source and worth flagging before anyone runs something unexpected:

  • inventoryConsolidationMR.js ships with TEST_MODE = true and TEST_ITEM_ID = 4550. As committed it processes one item, not all inventory. Its header says to flip the flag "before going full".
  • inventoryTransferTest2.js is a test script with a transfer order ID (4697590) hardcoded in the body.
  • The print button scripts reference a path that looks like a leftover. Both printBoLButton.js and printCoAButton.js set clientScriptModulePath to SuiteScripts/Foster/... and carry the comment <-- your actual path. If a print button ever fails silently, this is the first thing to check.
  • palletSync.js's header asks you to verify that ACTIVE_STATUSES matches the current pallet status internal IDs and that ADJUSTMENT_ACCOUNT_ID is right, before deploying.

Tech Stack

TechnologyVersionPurpose
SuiteScript2.1 (2.x on older files)NetSuite server-side scripting
N/recordRecord create, load, transform
N/searchSaved and ad-hoc searches
N/querySuiteQL from Suitelets
N/taskScheduling Map/Reduce jobs
N/renderHTML template rendering for BoL and CoA

There is no package.json, no build step and no test suite. Files are deployed to the NetSuite File Cabinet as-is.

Interfaces

SystemDirectionPurpose
SunApps GatewayinboundCalls the Restlets for counts and invoicing
NetSuite recordsbothInvoices, Item Fulfillments, Inventory Adjustments, Transfer Orders

Operations

There is no CI in this repository and no deployment automation. Scripts are placed in the NetSuite File Cabinet and script/deployment records are created in NetSuite by hand.

The consequence worth understanding: this repository is a copy, not the source of truth. Nothing verifies that a file here matches what is deployed in the account. Suntado_SDF is the repository that uses SuiteCloud Development Framework for managed deployment.

Failures surface in NetSuite's script execution logs. The Map/Reduce scripts log deliberately — inventoryBinReset.js in particular logs lot data at each failure stage specifically so a partial run can be reversed by hand.

Repository

RepositoryIdaMilk/SuiteScripts
Primary languageJavaScript (SuiteScript 2.x)
Files17
Last activity2026-07-22
StatusActive
READMENone