Is there any way to retrieve the internal id of a ...
# suitescript
j
Is there any way to retrieve the internal id of a record being created AS it’s being created? I need to write our own “autonumbering” functionality, which will include the internal id of the record in the name. I would prefer not to have to reload the record and re-save it just to get the internal id.
a
you can't 😞 I just had to save and reload I was looking for this exact solution about 2 weeks ago without luck... so curious to hear any suggestions people have
c
@jen You don't get it from afterSubmitContext.newRecord.id?
Let me rephrase that 😄 I have a script that generates a number based on the internal ID of an item on save. What I do is get the id from
context.newRecord.id
in afterSubmit, then use that with search.lookupFields and record.submitFields to create the number. Granted, it's similar to reloading and saving, but there's no other way to get the internal ID than wait for after submission
🙌 1
j
yeah
f
What @Clay Roper said.
i
just wanted to point out in case you need your auto numbering to be sequential, depending on the record type the internal id is not always sequential