I've got an object CustomTable__c which has a lookup relationship Account__r to the Account object, and an External ID field ExternalId__c.

I'm trying to use the API to get the Account record, given the External ID of the custom record.

The URL is as follows:


This returns a 404.

If I remove Account__r from the URL, then I get a 200 along with the custom record, so the custom record definitely exists, and is able to be retrieved using this field.


If I refer to the custom record by its Salesforce id instead, then the API returns the Account record that I'm asking for.


Is there something I'm doing wrong, or does this functionality of the API only work when using the Salesforce id, and not when using a custom id field?

  • 1
    Does your connected user have FLS to the field ExternalId__c? – David Reed Jan 6 at 16:27
  • Hi David, yes it does. I think this can be demonstrated by the 2nd URL working as expected (I may be wrong, I am on week 2 of my salesforce journey!) /services/data/v46.0/sobjects/CustomTable__c/ExternalId__c/SourceSystem_12345 That one works. – Joe Howells Jan 6 at 16:53
  • You're correct, of course - my apologies for reading your question too quickly! – David Reed Jan 6 at 16:55

This isn't concrete evidence, but I'd suggest creating a case with Salesforce support to confirm it.

My initial testing leads to the same results you're noticing.

There's no explicit mention that the external Id field can be used in Traverse Relationships with Friendly URLs (granted, there's no mention it cannot) and that seems important given how they do have documentation specific for utilizing external ID. Those only seem to go over the functionality you do see working.

  1. Get Field Values with External ID
  2. Retrieve Record with External ID
  3. Insert or Update Records using External ID
| 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.