You need to sign in to do that
Don't have an account?
Duplicate user Name while deploying the changeset in production
Hi All,
I have few test class in my sandbox .I am trying to deploy the code in production by using the
changeset .
I am getting the below error only in one class
Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_USERNAME, Duplicate Username.<br>Another user has already selected this username.<br>Please select another.: [Username]", Failure Stack Trace
I have checked the user name in all the test class all are unique only.I have used follow things in this test class.
1.@isTest(SeeAllData=false)
2. Profile p=[select Id from profile where name='HRMS Employee Manager'];
User Mngr = new User(alias='Con2', email='arishRev2@gmail.com',emailencodingkey='UTF-8',lastname='Manager',languagelocalekey='en_US',localesidkey='en_US',profileid=p.id,timezonesidkey='America/Los_Angeles',username='consleaguerevcon2@consleague.com');
insert Mngr;
Please help me how to resolve this error.
In Prod, under Setup->Administration Setup-->Manage Users-->Users please check whether the user "consleaguerevcon2" already exists!
Hi ,
Thanks for relpy .
I have checked this there is no user in the same name.
Try "upsert" instead of "insert".