RE: Auto Numbering of a Custom Field

Hi All,

I created a custom field in a customer invoice. I want it to work like the document number wherein it will automatically generate a number upon saving the transaction. How can I do this? Is this possible?



jdu Rookie Asked on February 10, 2021 in SuiteScript.
Add Comment
3 Answers

First option that requires no planning for concurrency is to create a custom record type that uses auto numbering  and creates a new custom record for every invoice and use its name as your custom field’s value

Second option that requires planning for concurrency is to use a custom record to store the next number you want to assign in a custom field. Load that custom record, get its number, update the old one by 1, save the custom record, then set your custom fields number to the number from the custom record. Expect to learn from the SAFE guide how to handle concurrency to handle cases where 2 invoices are created at the same time.

Advanced Answered on February 12, 2021.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.