Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
How to Set External ID via Script?
Hi There
I am trying to set the external ID value on a customer record using a userevent script.
I have tried with different entry points--before submit and after record submit.
There is no error message though the external id is not being updated either.
this is the script:
/**
*@NApiVersion 2.x
*@NScriptType UserEventScript
*/
define(["N/record"], function (record) {
/**
* @param {UserEventContext.beforeSubmit} context
*/
function beforeSubmit(context) {
var customer = context.newRecord
var customerId = customer.getValue({ fieldId: "entityid" })
var id = customer.id
log.debug("id", id)
var externalId=customer.setValue("externalid", customerId)
// customerNew.save()
log.debug("customerNew", externalId)
}
/**
* @param {UserEventContext.afterSubmit} context
*/
function afterSubmit(context) {
var customer = context.newRecord
var customerId = customer.getValue({ fieldId:
Tagged:
0