I'm trying to do something fairly simple that is somehow causing me some problems. I'm trying to access a Record on Netsuite through a Restlet.
here is my code:
/**
@NApiVersion 2.x
@NModuleScope Public
@NScriptType Restlet
*/
define(['N/record'], function(record) {
function getRecord() {
var recordType = 'salesorder'; // I've also tried record.TYPE.SALES_ORDER
var recordID = 'CONF39932'; //A hardcoded sales_order Id just to try to get something back
var loadedRecord = record.load({
type: recordType,
id: recordID
});
return { msg: loadedRecord };
}
return {
get: getRecord
};
});
I get back a pretty cryptic error:
{"type":"error.SuiteScriptError","name":"UNEXPECTED_ERROR","message":null,"stack":["loadRecord_impl(N/recordImpl)","getRecord(/SuiteScripts/customTest/getRecord.js:12)"],"cause":{"type":"internal error","code":"UNEXPECTED_ERROR","details":null,"userEvent":null,"stackTrace":["loadRecord_impl(N/recordImpl)","getRecord(/SuiteScripts/customTest/getRecord.js:12)"],"notifyOff":false},"id":"73f69a57-afa8-4c3e-854c-493add4cf222-2d323031382e31322e3031","notifyOff":false,"userFacing":false}"
Anybody has any tips?
Thanks a lot
id should be the Internal ID of the record, not the record's name.
also, type is record.Type.SALES_ORDER - it's case sensitive.