I have an AutoNumber field in my leads. I'm assigning leads based upon the last digit of that field. Salesforce says the following code has no syntax errors:

RIGHT(RoundRobin__c, 1) == text(1) || RIGHT(RoundRobin__c, 1) == text(4) || RIGHT(RoundRobin__c, 1) == text(7) || RIGHT(RoundRobin__c, 1) == text(0)

However, the AutoNumber field seems to me like it must be a number, not a string. When I try to convert to a string, it says that RoundRobin__c is of type "text" and therefore the conversion isn't necessary. I just wanted to make sure that this won't cause any problems with my logic.

1 Answer 1


The maximum length of an Auto Number field is 30 characters, 10 of which can be the number and 20 of which can be the prefix.

Your starting number must be less than 1,000,000,000, which means that the most that you can start it out at is 999,999,999. That means that in the worst configuration you could make you'd still be able to create ~9 billion records (9,999,999,999 - 999,999,999) before you'd reach the maximum allowed. I don't know what happens when it hits 11 digits, although if the docs state the max is 10 digits then I'd expect an error.

Check out the doc page on custom field attributes, specifically the Staring Number entry.

  • Custom field attributes help.salesforce.com/apex/… Oct 5, 2015 at 13:43
  • Right, but I'm asking if AutoNumber is a number or a text field. It seems that it is a text field because I can't convert it using text().
    – AKor
    Oct 5, 2015 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .