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
ClaiborneClaiborne 

Testing Quandry

I have a number of custom objects that I used in a salesforce.com organization. Many of these objects use auto-numbered Name fields.

The problem occurs when running Apex tests. Although the data created during the tests is never committed, creating new records in objects with auto-numbering increments the auto number. Because of the recursive nature of the tests (and some behind the scenes testing whenever new code is deployed from the Force.com IDE), my users are getting disconcerting jumps in things like order numbers, purchase requisition numbers, inventory numbers, etc. I tell them that the numbers are truly meaningless, but missing numbers is still a point of concern.

So I have a few questions.

Is there any programmatic way to find out what the "next number" is for an object?

Is there any programmatic way to suspend, and then resume, auto numbering?

Is this something I just need to get my users to live with?

Comments are appreciated.
JamsieJamsie

We have the same issue and it's causing a problem within our audit team who expected a contiguous list of record numbers.

 

I can't prove if a number was used in a test or has been permanently deleted.