Print this page

Why A Case Autonumber May Appear To Skip Some Numbers

Knowledge Article Number 000006733

Why does a Case Autonumber appear to skip some numbers


The Case Number field in Salesforce 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. To prevent this from happening, enable Independent Auto-Number Sequence. Click here for more information. 
  • 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.

promote demote