Creating an Autonumber on Update

Dec 16, 2013 at 3:48 PM
I have a requirement where an invoice is generated with an initial status of Pending. Later the invoice can be set to Finalised and it's not until this time that an invoice number is required to be generated in the format AC-yy-9999.
Where yy is the year at the time of finalisation and 9999 is a autonumber sequence. Also the sequence number must be reset back to zero at the start of the year.

How do I use the tool so that when I update the entity record, I can generate the autonumber and NOT when it is originally created?