Write a SuiteScript 2.x script to set lot number and bin assignments on an Item Receipt subrecord (InventoryDetail) when receiving components against a work order
Commit the parent line with rec.commitLine({sublistId: 'item'}) after setting the subrecord, then call rec.save().
Validate that the feature 'MULTILOCINVT' or 'LOTNUMBEREDINVENTORY' is enabled for the item; otherwise the inventorydetail subrecord field will be null.
Known gotchas
Subrecords in NetSuite REST API (non-SuiteScript) have a different access pattern — you cannot use getCurrentSublistSubrecord via REST; instead POST the subrecord body inline using the nested subrecord endpoint.
Calling rec.getSubrecord instead of rec.getCurrentSublistSubrecord when in dynamic mode returns a body-level subrecord, not a sublist-line subrecord — they are different fields and the error is silent.
The field ID for the lot number on receipt is receiptinventorynumber, not inventorynumber — using the wrong field ID silently stores nothing and the lot is left unassigned.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp