Prabhu
Prabhu

Reputation: 927

How to create User Notes for the Customer in Netsuite using RESTlet?

i could create customer record using RESTlet in Netsuite by the following code.

$datastring = array(
    "gu_action"=> "create",
    "recordtype"=>"customer",
    "companyname"=>"Test name customer",
    'subsidiary'=>1,
);

The RESTlet file link is : https://gist.githubusercontent.com/ganeshprabhus/68a9e5b81e53436bb1d684f857a6c31f/raw/67fe03895f1c31d65c1f283dd51584af45d27c59/NS_Script_2016.2004

But now i want to add user notes for the particular customer using RESTlet. please refer the below imageenter image description here

Upvotes: 0

Views: 2361

Answers (2)

lukeaus
lukeaus

Reputation: 12265

Here is an example of how to link a note to a lead with a RESTLet using API v 1.0

function createLeadWithNote(datain) {
  try {
    var recordLead = nlapiCreateRecord('lead); // create lead
    recordLead.setFieldValue(lastname, 'Smith'); // set values
    var recordLeadId = nlapiSubmitRecord(recordLead); // save lead

    var recordNote = nlapiCreateRecord('note'); // create note
    recordNote.setFieldValue('title', 'Some title'); // set values
    recordNote.setFieldValue('note', 'Some note text); // set values
    recordNote.setFieldValue('entity', recordLeadId); // link note to lead
    var recordNoteId = nlapiSubmitRecord(recordNote); // save record

    var nlobj = nlapiLoadRecord(recordLeadType, recordLeadId); // get lead
    return nlobj; // return lead
  } catch (err) {
    throw nlapiCreateError('UNEXPECTED_ERROR', 'Error: could not create lead');
  }
}

Upvotes: 0

Rusty Shackles
Rusty Shackles

Reputation: 2850

The record type for User Note is note if I recall correctly. So your restlet will need to create a note record and link that to the Customer.

Upvotes: 1

Related Questions