Error: 'Duplicate external id specified' when upsert to Salesforce
Hello everbody I am working with Talend to load data to SF and I found a puzzling error. I read data with ODBC and load them to SF with a suitable componente. I am using upsert with a External ID. I have several jobs and when testing oe of them I got this error: java.lang.Exception: Duplicate external id specified: wc000001 at org.talend.salesforce.SforceManagementImpl.upsert(SforceManagementImpl.java:863) at gestion_integral___argonauta.step5_0_5.Step5.tDBInput_1Process(Step5.java:3214) at gestion_integral___argonauta.step5_0_5.Step5.runJobInTOS(Step5.java:11436) at gestion_integral___argonauta.step5_0_5.Step5.main(Step5.java:11295)
So data was not loaded. The thing is that data is already loaded so Talend should just have to update them, but it didn't. And the most puzzling for me was that... I deleted that record from Salesforce and after running again the job I got the same error. I found out if I delete the row from my database (it's a ADS, using ODBC to connect to it) and I created again it worked... but I don't know why, and I don't want to solve it that way... since it could be impossible to solve when data amount is huge! Why did I get that error? How could I solve it? Thanks very much
Re: Error: 'Duplicate external id specified' when upsert to Salesforce
Hi, Today I was also facing the same issue I think the issue is that : Upsert uses the sObject record's primary key (or the external ID, if specified) to determine whether it should create a new object record or update an existing one:
If the key is not matched, then a new object record is created. If the key is matched once, then the existing object record is updated. If the key is matched multiple times, then an error is generated and the object record is neither inserted or updated.
So if suppose there is already a record present and in datae there are two records to be upserted so for 1st records condition 2 is fulfilled and it is upserted but when again for updating the second record it becomes condition 3 so the records are not upserted and it throws error