Generate a sequential numeric value automatically for each new entry, taking as a reference the value of the same field from the previous entry

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Hello there,
A rookie question. I’m playing around with Strapi, building my own invoice generator/manager.
I created a content type with a UID field to give/store the invoice number. Considering that the value should be a sequential (22-0001, 22-0002, etc.), I would like to autogenerate it for each new entry to avoid typos.

My approach is with lifecycle, but not sure (if it’s possible) how to get the value of the field from the previous entry to generate it.

Thank you!