You need to sign in to do that
Don't have an account?
Gaurav Agnihotri 11
Error in SOQL master Detail (custom)
trying to create a SOQL on the Master - Detail
Master: Opportunity
Detail: Opportunity_Split_Reporting_Lens__r
field : Opportunity_Name ( Id of opportunity)
I am able to go from child to parent
select Opportunity_Account_Name__c from Opportunity_Split_Reporting_Lens__c
How can i get child record from parent?
select name, (select name from Opportunity_Split_Reporting_Lens__r) from Opportunity limit 5
Error message:
ERROR at Row:1:Column:32
Didn't understand relationship 'Opportunity_Split_Reporting_Lens__r' in FROM part of query call. 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.
Master: Opportunity
Detail: Opportunity_Split_Reporting_Lens__r
field : Opportunity_Name ( Id of opportunity)
I am able to go from child to parent
select Opportunity_Account_Name__c from Opportunity_Split_Reporting_Lens__c
How can i get child record from parent?
select name, (select name from Opportunity_Split_Reporting_Lens__r) from Opportunity limit 5
Error message:
ERROR at Row:1:Column:32
Didn't understand relationship 'Opportunity_Split_Reporting_Lens__r' in FROM part of query call. 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.
Check your child relationship name in your opportunity lookup field at Opportunity_Split_Reporting_Lens__c object.
don't use the object api name with __r. you have to use the Child Relationship Name __r from the Opportunity lookup field in Opportunity_Split_Reporting_Lens__c.
Go to --> Opportunity_Split_Reporting_Lens__c --> open Opportunity lookup field --> copy the Child Relationship Name --> then use that name in your query with __r.
Please refer below screenhot:
based on my screenshot i have to use like:
Select Name, (select id from members__r) from Opportunity
Can you please Let me know if it helps or not!!!
If it helps don't forget to mark this as a best answer!!!
Thanks,
Raj C
All Answers
Check your child relationship name in your opportunity lookup field at Opportunity_Split_Reporting_Lens__c object.
don't use the object api name with __r. you have to use the Child Relationship Name __r from the Opportunity lookup field in Opportunity_Split_Reporting_Lens__c.
Go to --> Opportunity_Split_Reporting_Lens__c --> open Opportunity lookup field --> copy the Child Relationship Name --> then use that name in your query with __r.
Please refer below screenhot:
based on my screenshot i have to use like:
Select Name, (select id from members__r) from Opportunity
Can you please Let me know if it helps or not!!!
If it helps don't forget to mark this as a best answer!!!
Thanks,
Raj C
http://www.sfdcpoint.com/salesforce/relationship-query-apex-salesforce/
http://www.sfdc99.com/2013/06/24/example-how-to-write-a-cross-object-soql-query-part-2/
http://sfdc.arrowpointe.com/2007/01/19/set-child-relationship-name-on-custom-relationship-fields/
http://www.riptutorial.com/salesforce/example/15600/soql-query-to-reference-parent-object-s-fields