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
IvanWatlingIvanWatling 

SOQL to get auto number?

Is there some SOQL I can write to find out what the next number generated by an auto number field will be?  I want to see how much an auto number field jumps when I run my unit tests.  I'm not allowed to create a new record and simply look at it's auto number field.

 

Thanks

NasipuriNasipuri

Hi ,

 

you can make a Query to the object as below

 

SELECT auto_Nuber_field FROM Object ORDER BY auto_Nuber_field DESC LIMIT 1

 

You will get the existing maximum number in the auto number.

 

Thanks,

Dinesh Nasipuri

Dinesh.Nasipuri@gmail.com