Netsuite: How to edit or update a record?

javascript, netsuite

Solution

To be a little more precise, use nlapiLoadRecord to fetch the record from the database. Set the fields as needed. Use nlapiSubmitRecord to save it.

Untested code off the top of my head:

var record = nlapiLoadRecord('record_type_goes_here', internal_id_of_record_goes_here);
record.setFieldValue('field_internal_id_goes_here', 'value to set goes here);
nlapiSubmitRecord(record);

Fill in the appropriate values where needed.

Problem

I am a newbie at NetSuite scripting. It looks like a normal EDIT or UPDATE function is not at all normal in the Netsuite. There are APIs for creating and deleting record like `nlapiCreateRecord` and `nlapiDeleteRecord`, but nowhere in the documentation I could find the way to edit and update the existing record. I have restrictions on using PHP. I have created a custom TFC customer form (server side js), which should be able to fetch the data and update if required. I have been able to fetch the records as of now, but please tell me how to update an existing record?

Original source