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

what is the logic written behind communitynick name field of user object to make the field unic

Hi All,

I have a trigger to create a user object when  organization records get created on org page layout we have email field  i created 
CommunityNickname  frmula field in org objet  like below ,i think this  what coming in user object , Now i am not sure how can i make this field unic like if i have a 2 email like and test1.user1@yahoo .com ....As per my logic it will allow to save org record but while creating user it is going to though an error.

can i add some logic in formula field or code that if  community nickname is not unic add ++1 or something to make the field unic?
LEFT(Email__c ,Find("@", Email__c )-1)

Lokesh KumarLokesh Kumar
Concat the email client as well.
LEFT(Email__c ,Find("@", Email__c )-1) + LEFT(RIGHT(Email__c, FIND("@",Email__c) ,FIND(".",Email__c)-1)

I need to think for field length as welll how can i achive that?
Lokesh KumarLokesh Kumar
Which field of user object are you mapping with the formula field?