0

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.

0

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.