Auto-increment Ticket ID

Hi,

I noticed that ID of the new ticket created is based on auto-increment, which is based on the setting of “HD Ticket” doctype in Frappe framework. I tried to search through the online documents of where the ID is kept and how I can change it (to a different number) but couldn’t find the way to do it.

Can anyone enlighten me? Thanks.

Go to Customize Form and select the HD Ticket DocType, and then go to the Naming Series section.

https://frappeframework.com/docs/user/en/basics/doctypes/naming

In the Customize Form - HD Ticket, the naming rule is autoincrement and greyed out. I want to keep the autoincrement, but I would like to reset the number to something else. e.g. the auto-increment number is at 366 (I can see this new HD ticket created and is auto assigned with this number, but I don’t know where this last number is kept). And I would like to set it to 1000 for the next HD ticket being created.

The number automatically increases by 1 based on the previous record in the database. For example, if the current ticket number is 366, the next will be 367.

Is it database generated or is it kept in some table? Can I reset it?

Auto increment is database generated. If you want to change it, then you will have to change the auto increment value in the database.

You have any idea how I can do this in database (mariadb)?

@gohyc
Sorry for the confusion earlier! Since Frappe uses a sequence for auto-increment in MariaDB instead of mariadb autoincrement, you need to update the value in the sequence.

Open the Frappe console by running this:

bench console

Run the following command to reset the sequence for the HD Ticket table:

frappe.db.sql("ALTER SEQUENCE hd_ticket_id_seq RESTART WITH 1000;")

Thanks, it works!