I want to create a invoice field with pattern yymmdd-ID, and ID is unique & autoincrement.
Please give me some solution?
If this was me, i would look at workflows. (I’m sure there other ways, but this is how i have done similar in the past)
When the record is saved you can get it to calculate a field. The invoice also have “invoice number” which is an auto increment field, so you can use this for your ID number.
So i would create a new field in the invoice module to store this in. then create a workflow which runs only on save and for new records.
The condition of the work groups should be new field = “” (empty)
The next step would be to look in to date format to get the day to do what you want. off the top of my head i can think of two ways, use the system parameters to change the date format for the whole site, or add another field within invoice and enter the date you want there in the correct format.
I think we have 2 solution for my problem:
- Firstly, using workflows.
- Secondly, using Logic hook for each insert new record.
And then, i am trying to second method. If you have any suggestion, please help me.