How to update a record using external id through NetSuite Restlet?

Hi,

I have a record and I have set a value in external id at the time of record creation. Now want to update that record using that external id. How can I do this in restlet?

 

Regards

Titu Singh

Beginner Asked on September 2, 2021 in SuiteScript.
Add Comment
14 Answer(s)

I am not able to view your last reply. page 2 is not being loaded.

Beginner Answered on September 7, 2021.
Add Comment
{
“error”: {
“code”: “SSS_MISSING_REQD_ARGUMENT”,
“message”: “id”
}
}
Beginner Answered on September 7, 2021.
Add Comment

Hi Chris, any update?

 

Beginner Answered on September 8, 2021.
Add Comment

To update a record in NetSuite using an external ID through a Restlet, you can follow these steps:

  1. In your Restlet code, create a new instance of the appropriate NetSuite record type you wish to update. For example, if you want to update a customer record, you would create a new instance of the N/record module’s customer object.
  2. Use the N/record module’s load method to load the record with the external ID. The load method takes two parameters: the record type and the external ID. For example:
    var customerRecord = record.load({
    type: record.Type.CUSTOMER,
    id: externalId
    });
  3. Once you have loaded the record, you can update its fields as necessary. For example, to update the customer’s phone number:
    customerRecord.setValue({
    fieldId: 'phone',
    value: '123-456-7890'
    });
  4. Finally, use the N/record module’s submitFields method to save the changes to the record:
    record.submitFields({
    type: record.Type.CUSTOMER,
    id: externalId,
    values: {
    phone: '123-456-7890'
    }
    });

    Note that you can also use the N/record module’s submitFields method to update the record without first loading it using load.

    In both cases, the id parameter should be set to the external ID of the record you want to update.

Beginner Answered on May 11, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   SuiteMigration   Become a Sponsor