I cannot seem to set an items externalid via suite...
# suitescript
m
I cannot seem to set an items externalid via suitescript (beforeSubmit UserEvent). However... I can set it via a browser console. Anyone ever experienced this?
Copy code
context.newRecord.setValue({ fieldId: 'externalid', value: id });
👍 1
SuiteAnswers: The External ID of an item record is a standard field that cannot be modified through User Interface. Modification can only be accomplished through CSV Import. Not exactly true because I can set it in the browser console.
Enhancement 149923
b
you cant set it before submit
but you can any other time you actually save the record
m
Copy code
require(['N/record'], function (record) {
  const instance = record.load({ type: 'assemblyitem', id: 201369 })
  instance.setValue({ fieldId: 'externalid', value: 'works' });
  instance.save()
})
probably why that worked in the browser console...
odd that SuiteAnswers so against it.
d
You can set it in a UE. I have a script that does this that we use all the time. You have to load/save, you cannot use newRecord or submitFields. You also cannot set it to empty/null after it's been set.