You need to sign in to do that
Don't have an account?
Shruthi GM 4
What is this error?..Why does this error comes up?
System.QueryException: Didn't understand relationship 'Id' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
You might have written the query in wrong way if you can share the query i will try to help you
This error comes when you are trying to fetch any fields of Child Object relationship may be Master/Lookup without inner query. If you want to fetch child object fields then use inner query. For example, the query is given below:
Hope this make sense :)
Thanks,
Amit
Hi Shruthi,
This error is potentially because you have given a wrong Relationship Name name in your nested inner query in SOQL.
Solution: Open workbench. Goto ->Info-->Standard & Custom Objects-->Choose your parent object
It will display the folders which will have one named as "Child Relationship"" Open this folder and choose the Child object you are refereing in your inner query. Choose the field "relationshipName" from this list and use it in your SOQL.
This will solve this error.
-Prakash
So if I have to fetch one of the fields from Opportunity object how do I write the inner query?
Like for Eg:- Select Id, NAme, (Select Id, Name From Vehicles__r) From Account
In place of Vehicles__r I need to add Opportunity object.How do I do that?
Please help.
From which object you need to fetch the Opportunity Filed?
Let me know so that I could help you. Also, paste your SOQL query here.
Thanks,
Amit
If you want to fetch Opportunity Fields from Account then use the below query.
Hope this will do the trick.
If this helps make answer as best answer and keep community clean :)
Thanks,
Amit Singh.
Below are some points for making downward SOQL and upward SOQL queries.
If you want to Fetch records from parent to child then you should use Inner query as above. If you want to fetch Parent record field then use the SOQL query like below. Also, check the API name of your object that you are using as parent Object.
Paste your query here and relationship between objects so that I could help :)
Thanks,
Amit Singh.
Can you paste your query here? I not totally sure what you are trying to select.
Prakash