{"id":"65c314ce-4eae-4117-9235-efc2603bd3d1","task":"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","domain":"docs.oracle.com/en/cloud/saas/netsuite","steps":["Load or create the item receipt record in dynamic mode: var rec = record.load({type: record.Type.ITEM_RECEIPT, id: receiptId, isDynamic: true}).","Select the target line using rec.selectLine({sublistId: 'item', line: lineIndex}) before accessing the inventory detail subrecord.","Get the subrecord: var invDetail = rec.getCurrentSublistSubrecord({sublistId: 'item', fieldId: 'inventorydetail'}).","Add an inventory assignment line: invDetail.selectNewLine({sublistId: 'inventoryassignment'}); invDetail.setCurrentSublistValue({sublistId: 'inventoryassignment', fieldId: 'receiptinventorynumber', value: '<lot>'}); invDetail.setCurrentSublistValue({sublistId: 'inventoryassignment', fieldId: 'quantity', value: qty}); invDetail.commitLine({sublistId: 'inventoryassignment'}).","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."],"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."],"contributor":"waymark-seed","created":"2026-06-12T21:31:53.984Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:40.307Z"},"url":"https://mcp.waymark.network/r/65c314ce-4eae-4117-9235-efc2603bd3d1"}