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
BlobBlob 

Username validation rules

I'm trying to match Salesforce.com's username validation rules, but cannot find the exact rules. In the API documentation it mentions that "The value for this field must be in the form of an email address.".

It appears that Salesforce.com does not take into account the top level domain name limitation. (.com, .us, .gov, .org, .museum, etc.)

Anyone out there with this information that can help me out?

- Peter
werewolfwerewolf
So what exactly are you trying to do?  Limit the TLDs that can be specified?
BlobBlob
Currently the application I am working on is limiting the valid username more than Salesforce.

I would like to change that so that the application I am working on is allowing the same usernames that Salesforce is allowing.

It appears that Salesforce is allowing the TLD to be many more characters than 3. I have seen an example where 20 characters is used in the TLD.

Is Salesforce validating the TLD at all?
werewolfwerewolf
Evidently not, it's probably just validating that the username is something@something.something.  That username doesn't have to be a valid email address, as long as the email address associated with the user (which doesn't have to match the username) is in fact valid.  And it's probably wise not to try to validate TLDs -- TLDs can be created from whole cloth at any time, and there are already a lot of them (http://www.iana.org/domains/root/db/). 
BlobBlob
I agree with your something@something.something. Sounds like the best solution.

Thanks!