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?

有帮助吗?

解决方案

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.

其他提示

For the benefit of anyone looking at this question who is concerned with performance, it is much more efficient to use

nlapiSubmitField(type, id, fields, values, doSourcing)

If you know exactly what you are updating. This is both faster than submitRecord, and avoids the often significant overhead of loading the record first.

The function used to edit an existing record is nlapiSubmitRecord. See definition here http://suitecoder.appspot.com/static/api.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top