Setting {externalID} on record save. Is it possibl...
# suitescript
p
Setting {externalID} on record save. Is it possible to set the externalid of a record on save? I want to set the Customer External Id to name the {nameorig} field
e
use record.submitFields in afterSubmit
c
I'm happy to be wrong, but I'm sure that you can only set externalid via CSV, REST and SOAP
e
It can be set using submitFields in an UE
c
I didn't know that. Thank you @ehcanadian
e
@PlanetJupiter Be sure to have a try/catch as if you may ever have more than one customer with the same name. If you save a Customer with the name McDonalds, the external ID will be McDonalds, if you have a second Customer with the name McDonalds, the record.submitField in afterSubmit will fail with an error of "can't have duplicate external ids" and no external Id will be set