You need to sign in to do that
Don't have an account?
Getting child object values using parent Id
Hi all,
I have Responses__c and Response_Type__c objects . Response_Type__c is parent to Responses__c . Now I have Response_Type__c Id so written Query as follows to get Response_type__c fields as well as Responses__c fields
List<Response_type__c> rtList = [select id,name,(select id,name from responses__c) from Response_type__c where id =: rt.id];
Now it raising error
Error: TestController Compile Error: Didn't understand relationship 'responses__c' 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.
then I changed the query as follows
List<Response_type__c> rtList = [select id,name,(select id,name from responses__r) from Response_type__c where id =: rt.id];
still the same error
Error: TestController Compile Error: Didn't understand relationship 'responses__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.
so please help me in resolving this. please explain what is root cause
All Answers