Set Custom Case Number and Increment From There

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anthony.senior
    Junior Member
    • May 2025
    • 11

    #1

    Set Custom Case Number and Increment From There

    I've come across a few posts on the forums from people that tried to do similar things regarding editing the Case number but I'm not sure what I'm missing and think I still need some help. I want to change the current Case number and set it to 125001 and then increment +1 from there. I also want to set a prefix, if possible, so that the next few cases look like this:
    C-125001
    C-125002
    C-125003

    If the case number must be an integer then that is fine, the C- isn't necessary. How can I go about manually changing the current Case #? Is it something in the database?
    I'm in Administration > Entity Manager > Case > Fields and there's "Number". When I open it, there isn't much to edit except Label and Tooltip Text. I added the field "Number (auto-increment)" and see some more customization options so I added "C-" as a prefix and then tried to set the Case number, but new cases are still incrementing from the old Case numbers. Would appreciate any help if someone knows the solution to this. I have a background in systems admin and cybersecurity but I am no programmer or coder so if it takes custom coding, please explain it to me like I'm 5 lol : )​

    Attached Files
  • yuri
    Member
    • Mar 2014
    • 9019

    #2
    Hi Anthony,

    The case number is an autoincrement field. It's controlled by the database.

    You can run this SQL to change the next number to 125001:

    Code:
    ALTER TABLE `case` AUTO_INCREMENT = 125001;
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • anthony.senior
      Junior Member
      • May 2025
      • 11

      #3
      Originally posted by yuri
      Hi Anthony,

      The case number is an autoincrement field. It's controlled by the database.

      You can run this SQL to change the next number to 125001:

      Code:
      ALTER TABLE `case` AUTO_INCREMENT = 125001;
      This worked! Thank you. For anyone using phpMySql or something similar make sure you have the Case entity selected then run the SQL Yuri put here
      Attached Files

      Comment

      Working...