function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ken_devken_dev 

Case Number out of Sequence

we've noticed that every once in a while our case numbers skip some numbers in their sequence.

So we have a case with a case # of 1000 and the next case # is 1013. We are not deleting any cases.

 

Is this normal? Has anyone else seen this?

werewolfwerewolf
The Case Number field in Salesforce.com is frequently seen to increase sequentially.  However, case numbers are not guaranteed to increase sequentially.  On some occasions, the case autonumber generator may appear to "skip" one or more numbers.

There are a number of reasons why the autonumber might appear to "skip" some numbers:
  • Case creation when an Apex testMethod is run.  By definition, these cases will be rolled back, but their autonumbers will not be given back.  This is the most common culprit, particularly if there is a large number of case numbers that have been skipped -- someone may have run many tests or run the same test repeatedly until it passed.
  • Some cases were deleted.  It seems obvious, but it should be mentioned here -- a common cause of autonumbers that appear to skip is that users have in fact created and then deleted some cases.
  • A case creation failure, namely a timeout or an error that caused the transaction to roll back.  This would not cause lost data though because the user would be immediately notified of the error condition and allowed to resubmit his case.
  • An autonumber counter reset.  The Case Number counter's start number is settable.  If someone resets it ahead, it will start counting from there, appearing to "skip" all prior numbers.