Hi Fellow NetSuiters,
I'm running into this issue where I cannot create a sales order from SuiteScript. I constantly get the below message when I try to call the RESTlet:
error code: JS_EXCEPTION error message:{"type":"error.SuiteScriptError","name":"INVALID_FLD_VALUE","message":"You have entered an Invalid Field Value 387 for the following field: item","stack":["anonymous(N/recordService)","doGet(/SuiteScripts/IMS Demo/cadran_rl_create_sales_order.js:34)"],"cause":{"type":"internal error","code":"INVALID_FLD_VALUE","details":"You have entered an Invalid Field Value 387 for the following field: item","userEvent":null,"stackTrace":["anonymous(N/recordService)","doGet(/SuiteScripts/IMS Demo/cadran_rl_create_sales_order.js:34)"],"notifyOff":false},"id":"","notifyOff":false}While I'm following the NetSuite documentation https://system.netsuite.com/app/help...267258059.html and https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4267255811.html#bridgehead_4273196114 for creating a transaction record I cannot come up with a solution anymore and I hope someone can tell me what I'm doing wrong here. For testing purposes I don't POST or GET any data and, so I've entered the entity id 80 and iternal item 387 in the code. I tried single, double and no quotes without any success.[ATTACH=JSON]{"alt":"Click image for larger version Name:tItem 387.png Views:t1 Size:t14.8 KB ID:t428856","data-align":"none","data-attachmentid":"428856","data-size":"full","title":"Item 387.png"}[/ATTACH] function doGet(requestParams) { //return "Hello World"; var rec = record.create({ type: record.Type.SALES_ORDER, isDynamic: true, defaultValues: { entity: 80 } }); rec.selectNewLine({ //add a line to a sublist sublistId: 'item' //specify which sublist }); rec.setCurrentSublistValue({ //set item field sublistId: 'item', fieldId: 'item', value: '387' }); rec.setCurrentSublistValue({ sublistId: 'item', fieldId: 'quantity', value: 1 }); //repeat above pattern to set the rest of the line fields rec.commitLine({ //writes the line entry into the loaded record sublistId: 'item' }); rec.save({ enableSourcing: false, ignoreMandatoryFields: false }); return rec; }And in case I remove the isDynamic option, I get the following error message:error code: JS_EXCEPTION error message:org.mozilla.javascript.EcmaError: TypeError: Cannot find function selectNewLine in object DeferredDynamicRecord. (/SuiteScripts/IMS Demo/_rl_create_sales_order.js#30)
Thanks in advance!