Auto Numbering of a Custom Field
This can be a tricky one when it comes to avoiding duplicates.
There’s nothing to do it as standard but there are some option we can explore.
How come you need a separate number and could it be based on the invoice number, for example?
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.