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
Yogesh BiyaniYogesh Biyani 

System.DmlException: Upsert failed. First exception on row 135; first error: DUPLICATES_DETECTED, You have an existing Account:

I am getting this error when I am during account upsert. What does the row number in this error message mean?  
Om PrakashOm Prakash
This error means your list of records has same record twice during upsert.

You can avoid that duplicacy by using set and before upsert clone back those records to list.

let me know if additional query 
 
Deepak Kumar SharmaDeepak Kumar Sharma
Hi Yogesh,
May be you are trying to upsert list of records, containing same id values e.g. you can see in below code i have two records in list that is going to be upsert, having same id value.

List<Account> liAcc = new List<Account>();
Account acc1 = new Account();
acc1.Name = 'Acc1';
insert acc1;
liAcc.add(acc1);

Account acc2 = new Account();
acc2.id = acc1.id; 
acc2.Name = 'ABC123';
liAcc.add(acc2);

upsert liAcc;

Regards,
Deepak
Yogesh BiyaniYogesh Biyani
Hello Om, Deepak,

Thanks for your comments. After using the Set this issue was resolved.

Regards,
Yogesh
Om PrakashOm Prakash
Thanks for confirming Yogesh.
Please mark previous replied answer as the soultion so that your question will be automatically marked solved and it could be helpful for other members as well !
Deepak Kumar SharmaDeepak Kumar Sharma
Thanks yogesh, If it really helpful to you please mark it as solved. and also mark one of the answere as best if you can.
Happy Coding :)