You need to sign in to do that
Don't have an account?
prady
how does upsert with external id work?
hi,
how does upsert work?
my understanding is that it checks if there is a record with unique id and if its available then it updates that record and if its not then inserts it.
Am i right?
I seem to get an error
Upsert failed. First exception on row 1; first error: DUPLICATE_EXTERNAL_ID, Asset Tag: more than one record found for external id field: [a11M0000000CwJqIAK, a11M0000000CwJvIAK]: [Asset_Tag__c]
i have a list with item and they dont have asset tag repeating in that
system.debug('LstItem Asset_Tag__c'+LstItem ); upsert LstItem Asset_Tag__c;
From the debug log
LstItem Asset_Tag__c(Item_c__c:{Scanned_By__c=005M0000000IlxyIAC, Asset_Tag__c=12149, Status__c=Active, Scan_Location__c=001M0000008GzJXIA0, Last_Scan_Date__c=2011-12-17 06:08:47}, Item_c__c:{Scanned_By__c=005M0000000IlxyIAC, Asset_Tag__c=23157, Status__c=Active, Scan_Location__c=001M0000008GzJXIA0, Last_Scan_Date__c=2011-12-17 08:26:14})
You can see that the asset tags are not repeated. So i am not sure from where the duplicate external id is coming
Thanks
Unique fields are unique to a record.
That means if you have one record in your database with Asset Tag value as 2400 then you can't create another record with same Asset Tag(2400).
what are these ids?
All Answers
Unique fields are unique to a record.
That means if you have one record in your database with Asset Tag value as 2400 then you can't create another record with same Asset Tag(2400).
what are these ids?
Hi Rahul,
Thanks for the pointer on the ids.. it turned out that there were 2 records already existing with same asset tag. Changed them to different asset tag and it worked now..