*INVALID_FLD_VALUE*05/16/2021 22:46:17.796 {"type"...
# suitescript
r
*INVALID_FLD_VALUE*05/16/2021 224617.796 {"type":"error.SuiteScriptError","name":"INVALID_FLD_VALUE","message":"You have entered an Invalid Field Value 3 for the following field: subsidiary","stack":["<anonymous>(N/record/recordService.js)","createPurchaseOrder(adhoc$-1$debugger.user:15)","<anonymous>(adhoc$-1$debugger.user:64)","<anonymous>(adhoc$-1$debugger.user:5)"],"cause":{"type":"internal error","code":"INVALID_FLD_VALUE","details":"You have entered an Invalid Field Value 3 for the following field: subsidiary","userEvent":null,"stackTrace":["<anonymous>(N/record/recordService.js)","createPurchaseOrder(adhoc$-1$debugger.user:15)","<anonymous>(adhoc$-1$debugger.user:64)","<anonymous>(adhoc$-1$debugger.user:5)"],"notifyOff":false},"id":"","notifyOff":false,"userFacing":false} /////////////////require(['N/record'], function(record) { function createPurchaseOrder() { var rec = record.create({ type: 'purchaseorder', isDynamic: true }); rec.setValue({ fieldId: 'entity', value: 7864 }); rec.setValue({ fieldId: 'subsidiary', value: 3 }); rec.setValue({ fieldId: 'location', value: 2 }); rec.selectNewLine({ sublistId: 'item' }); rec.setCurrentSublistValue({ sublistId: 'item', fieldId: 'item', value: 387 }); rec.setCurrentSublistValue({ sublistId: 'item', fieldId: 'quantity', value: 1 }); subrecordInvDetail = rec.getCurrentSublistSubrecord({ sublistId: 'item', fieldId: 'inventorydetail' }); subrecordInvDetail.selectNewLine({ sublistId: 'inventoryassignment' }); subrecordInvDetail.setCurrentSublistValue({ sublistId: 'inventoryassignment', fieldId: 'receiptinventorynumber', value: 'myinventoryNumber' }); subrecordInvDetail.commitLine({ sublistId: 'inventoryassignment' }); subrecordInvDetail.selectLine({ sublistId: 'inventoryassignment', line: 0 }); var myInventoryNumber = subrecordInvDetail.getCurrentSublistValue({ sublistId: 'inventoryassignment', fieldId: 'receiptinventorynumber' }); rec.commitLine({ sublistId: 'item' }); var recordId = rec.save(); } createPurchaseOrder(); });
b
pretty clear error, the subsidiary with internal id 3 is not valid for the entity with internal id 7864
usually you can verify that yourself in the ui
d
Hey, here's how to create a "snippit" to share long bits of code: Create or paste code snippets in Slack note that you can't add a snippet by editing an existing message