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
vinay pannalavinay pannala 

Getting System.DmlException: Upsert failed. First exception on row 2; first error: INVALID_FIELD, Foreign key external ID:

we are trying to upsert the contact in a method and then upsert/update the same contact with external id

upserting the contact and updating in the same transaction

System.DmlException: Upsert failed. First exception on row 2; first error: INVALID_FIELD, Foreign key external ID:

concurrency issue 

Tried FutureMethod Not Wroking inbetween there are callouts also any solution please
SSP AdminSSP Admin
Hello Vinay

It looks like our team of experts can help you resolve this ticket. We have Salesforce global help-desk support and you can log a case and our Customer Success Agents will help you solve this issue. You can also speak to them on live chat. Click on the below link to contact our help-desk. Trust me it is a support service that we are offering for free!

https://jbshelpdesk.secure.force.com

Thanks,
Jarvis SFDC team
AbhishekAbhishek (Salesforce Developers) 
Hi Vinay,

You can try the suggestions as mentioned in the below blogs,

https://developer.salesforce.com/forums/?id=906F0000000D867IAC

https://salesforce.stackexchange.com/questions/156181/invalid-field-foreign-key-external-id-not-found-inserting-related-records-via

https://developer.salesforce.com/forums/?id=906F000000093Y3IAI


It might help you.