0

I have a problem to attempt to the Order object based on the custom Contact lookup. I use the query:

select Id, (select id from Orders ) from Contact

and the object looks like that: enter image description here

The error is:

Didn't understand relationship 'Orders' in FROM part of query call.

0

1 Answer 1

2

As this is a custom relationship between Contact and Orders, you will have to use __r with the child relationship name.

So your query should be

select Id, (select id from Orders__r) from Contact

You can get further information about the custom relationship name and how to use parent to child relationship queries at this salesforce documentation Understanding Relationship Names, Custom Objects, and Custom Fields

2
  • +1. Good explain. Aug 7, 2019 at 11:07
  • Hi @Quicki if this or any answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. Sep 3, 2019 at 9:42

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