I've got a ASP.NET WebAPI project that must integrate with a Salesforce instance, using the OData 4.0 adapter for Salesforce. Searching and viewing my external objects is working fine, but I am unable to create instances.

I've turned on logs, and Salesforce is doing a POST to our create endpoint with a correct model, and our side is handling it fine and then returning a 201-Created response containing $odata.… metadata. However, Salesforce shows the error:

External Object Error. The external object record for external data source “/x00” can’t be created. Verify the primary key values.

What exactly is Salesforce expecting in the response from the POST request? And is there a way to get Salesforce to redirect to the parent entity, rather than showing details of the created entity on creation?

Apologies if this is in the documentation, but I've not been able to find it.

  • I got the same error while building a graphql adapter. No idea on how to fix it.
    – pwaterz
    Dec 11, 2023 at 19:53

2 Answers 2


There are a number of things you can do to get rid of this...

  1. Make sure your entity exposes a ExternalId string property
  2. Ensure the ExternalId property is listed as Edm.String in the OData $metadata XML response
  3. Make sure that the external Id is never null and is always unique

It's a really vague error so there's probably loads of things that caused it - however fixing the above got it working for us.

  • 1
    I find doing anything w/Salesforce Connect to be highly guarded information that is probably lucrative to protect. Thanks for sharing your findings
    – bkwdesign
    Jan 11, 2022 at 22:05
  • I agree. The documentation is basically non existent. I've been pulling my hair out trying to reverse engineer how it works.
    – pwaterz
    Dec 11, 2023 at 19:54

In case others reach this thread due to the error message, beware that your issue may have nothing to do with what the error message says and, instead, be because of this unsolved Known Issue (at the time of writing): The external object record for external data source "XX" can't be created.Verify the primary key values." error when running query on external object.

  • While this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – identigral
    Jul 28, 2022 at 23:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .