You need to sign in to do that
Don't have an account?
Vijay Nagarathinam
Community exception
Hi All,
I am getting the below error in my community. I don't know how to handle this exception.
The error message is: Duplicate Username.<br>The username already exists in this or another Salesforce organization. Usernames must be unique across all Salesforce organizations. To resolve, use a different username (it doesn't need to match the user's email address).
Let me know how to handle this exception
Thanks,
Vijay
I am getting the below error in my community. I don't know how to handle this exception.
The error message is: Duplicate Username.<br>The username already exists in this or another Salesforce organization. Usernames must be unique across all Salesforce organizations. To resolve, use a different username (it doesn't need to match the user's email address).
Let me know how to handle this exception
Thanks,
Vijay
Hi Vijay,
Could you please elaborate your use case, when you are getting this error.
Thanks,
Yogesh Sharma
Thanks,
Vijay
You cannot handle this error if you are using the standard self registration page of communitiy. This is a requirement from Salesforce that the username has to be unique across all the Salesforce org. If the end user is getting this error, then he has to register with some other username. If you want to handle this error, create a custom VF page for self-registration and have a try catch block. Then you can show a customized error message to the end user.
Thanks for your response. Currently, I am using custom vf page for self-registration page. But I am not able to handle this scenario. Becuase the username is unique for entire org. In this case, I am not able to get the details.
Can you help me how to resolve this issue?
Thanks,
Vijay
Can you please post the controller code here. Thanks.
If you are creating User use following piece of Code for creating Unique Username
Let me know if this works for you!
Thanks,
Nachiket
This will ensure that username will be always unique, but this defeats the purpose of having a user friendly username. The prefix generated by getUserNamePrefix method will be very complicated and hard to remember.
Please refer the below controller.
Thanks,
Vijay
Put try and Catch block around
Please elaborate more what exactly your requirment is! Do you want to handle this exception and show an userfriendly error message or do you want to generate unique username each time user register from site.
Please provide more details.
Thanks,
Nachiket
Thanks,
Vijay
Thanks,
Nachiket
Thanks for the reply, still I am getting the duplicate username exception. Please let me know how to resolve this issue.
Thanks,
Vijay
Could you please post your latest code and a screenshot of exception you are getting, that will help me undersatd issue to provide you better solution.
Thanks,
Nachiket
Thanks,
Nachiket
Thanks,
Nachiket