Hi I'm trying to find an example of linking a user note to an existing supportcase record in a Netsuite RESTlet script. I'm fairly new to javascript and netsuite, so trying to figure this out myself is running me up the wall.
Thanks in advance.
Hi I'm trying to find an example of linking a user note to an existing supportcase record in a Netsuite RESTlet script. I'm fairly new to javascript and netsuite, so trying to figure this out myself is running me up the wall.
Thanks in advance.
Here is a block of code used to create a note and attach to an entity record. It would be similar to your needs on the support case record. Hope this helps.
// new note
var noteObj = {
"note": decodeURIComponent( data[param] ),
"title": decodeURIComponent( data[param+"_title"] )
}
// set the note entity to the lead
var noteRecord = record.create({
type: record.Type.NOTE
}).setValue({
fieldId: 'entity',
value: recordId
}).setValue({
fieldId: 'note',
value: decodeURIComponent( noteObj.note )
}).setValue({
fieldId: 'title',
value: decodeURIComponent( noteObj.title )
}).save({
enableSourcing: false,
ignoreMandatoryFields: true
});
Thanks for the replies on this. Here is my working script using SuiteScript 1.0:
function newNote(datain)
{
// new note
var record = nlapiCreateRecord('note');
// set the note activity value to the case id
record.setFieldValue('activity',datain.recordID);
record.setFieldValue('note',datain.note );
record.setFieldValue('direction',1 );
record.setFieldValue('notetype',9 );
record.setFieldValue('title',datain.title );
var recordId = nlapiSubmitRecord(record);
nlapiLogExecution('DEBUG','id='+recordId);
var nlobj = nlapiLoadRecord('note',recordId);
return nlobj;
}