Hi ... can anyone please help to resolve ‘system:U...
# general
k
Hi ... can anyone please help to resolve ‘system:UNEXPECTED_ERROR ‘ while creating vendor record using suitescript? Error i am getting while creating vendor record using restlet suitescript2.0 is : system:UNEXPECTED_ERROR {“type”:”error.SuiteScriptError”, “name””UNEXPECTED ERROR”,”message”null, “stack”:[“<anonymous>(N/record/recordService.js)”,”<anonymous>(adhoc$-1$debugger.user:59)”,”<anonymous>(adhoc$-1$debugger.user:1)”], “cause”{“type””internal error”,”code””UNEXPECTED ERROR”,”details”null,”userEvent”:null, “stackTrace”:[“<anonymous>(N/record/recordService.js)”,”<anonymous>(adhoc$-1$debugger.user:59)”,”<anonymous>(adhoc$-1$debugger.user:1)”],”notifyOff”:false}, “id””bc91b425 23e0 44a7 8a65 98c616844073 2d323032302e30342e3033″,”notifyOff”false,”userFacing”:false}
b
share the code
otherwise get started with a support case
k
this is tge code i tested in script debugger
;require(['N/error', 'N/record', 'N/runtime', 'N/search'], function(error, record, runtime, search) { var objVendorRecord = record.create({ type : record.Type.VENDOR, isDynamic: true, defaultValues:{customform : 130} }); //Primary Information objVendorRecord.setValue({fieldId :'isperson',value:'F'}); objVendorRecord.setText({fieldId :'companyname',text:'facebook'}); //log.debug(requestBody.name); //Email/Phone/address objVendorRecord.setValue({fieldId :'email',value:'kondapalli@dotsolved.com'}); objVendorRecord.setValue({fieldId :'phone',value:'999-999-9999'}); //Save record var vendorId= objVendorRecord.save({ignoreMandatoryFields: true}); log.debug('Vendor Record created successfully & Vendor Id: ' + vendorId); var t = 5; });
b
set ignoreMandatoryFields to false
you will probably get a better error message
s
If that doesn't work, start removing functionality from your script (until something works) and then add logic back until it breaks again. Sometimes it can be hard to figure out what's causing an unexpected error.