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
BBajajBBajaj 

Need to generate auto number using apex code for a text field

Hello All,

 

There is a situation like I need to copy a text field say loginID for accounts from its parent account(if any) and if there is no parent account for a record, I need to generate an auto number for that records. I can't fetch records based upon lastmodified date because number of records are more than 50000. Any suggestions are most welcome.

 

Thanks

Jake GmerekJake Gmerek

We do something similar.

 

What we do is we have a hidden number field that is a numerical copy of the number.  Then you query for the highest number in that field, add one to it and then set both the text field and the number field to the new value.