Say I have an invoice object that has an internal unique ID and should get another invoice ID.
The format of the invoice ID should be: YY-MM-# where # increases with every invoice generated.
How can I create such an autoincrement number? I create an ID text field, but how to fill it? With a trigger? But how?
My basic idea was to compare a new invoice with the last one that was created. If it was created in an earlier month, start counting afresh.
How would you solve that problem? If possible, just using the formula field, or if not possible, with Apex, maybe with a trigger.