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
sdbsdb 

I am finding that Username can be duplicated across orgs when creating the user from a Portal

I know that this contradicts the SF documentation which states that a User's username must be unique across all organizations, however I am finding that this is not true when the user is created using Site.createPortalUser from a Site self-registration page.  For example, I have an SF developer account that I created last year using my personal email address. When I login to SF and look at the username for my User record it is my personal email address.  If I try to create a new developer account at login.salesforce.com using that same email address I am prevented from doing so. So far so good.

 

However, I also have a Site associated with a different SF organization, and this Site allows user's to self-register using their email address. The email address is currently being used as the Username when the User is created. When self-registering from this Site, I am able to register using the same personal email address that was already used when I set up my developer SF account. I am however prevented from duplicating that Username within that organization.

 

I have screenshots showing the same Username being used in two different SF accounts, so believe me this is happening. I am speculating that the reason that this works is because when you come in via the login.salesforce.com url, the organization wide uniqueness of the Username must be enforced because the Username is used to identify and route the user to the org that the he belongs to. However when you come in via the Site url, the organization is already known, so cross-organization uniqueness is not checked when the user is created.

 

Can anyone from Salesforce comment on this? Have I found a loophole that will be closed, or is this the way that things work?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
TrimbleAgTrimbleAg

I am not from SFDC, but this is not a loop hole, just how it works...

 

Because it is a specific address the user is logging in to for the portal/sites that is not the standard www.salesforce.com, it doesnt pertain to these users. Now if it is internal licenses, it will not allow you because you are signing in where everyone with a SFDC license signs in, does that make sense?

 

PB

All Answers

TrimbleAgTrimbleAg

I am not from SFDC, but this is not a loop hole, just how it works...

 

Because it is a specific address the user is logging in to for the portal/sites that is not the standard www.salesforce.com, it doesnt pertain to these users. Now if it is internal licenses, it will not allow you because you are signing in where everyone with a SFDC license signs in, does that make sense?

 

PB

This was selected as the best answer
sdbsdb

It does make sense, and that is the way I hoped it would work, thank you :-)