• Sreedhar D
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 1
    Replies

I have trying to upsert data by using API in salesforce. and while upserting I get and " duplicate ID Exception". when passing the array.
how can fix this. i know my  array has records with same external id(duplicate). But thats why I am upserting them. how can I over come this limitation. it happens with apex to. here is for sample.

list<account> li= new list<account>();
for(integer i =0;i<50;i++){
    account acc= new account();
    acc.name='' tech corp"; 
    acc.company_email__C='example@teccorp.com'; /*this field is an external id */
    acc.updated_count__C=i;
    li.add(acc);
}
upsert li company_email__C;
This also gives the same Error.

Thanks 
Abhilash Mishra