i am at a wits end, any help greatly appreciated

I have a child object named acf_address__c , that is a child of the contact object

the child relationship name on the acf_address__c is called Constituent_Addresses

I run the following query, and always get the contact id, name and null for my child subquery, i believe i have it correct, and know that data exists for both the parent and the child of this contact Id

select id , name
,(SELECT Name, MailingStreet__c FROM Constituent_Addresses__r)
from contact
 WHERE Id  = '0030R00000OsKCjQAN';

( i did not name any objects, dealing with aftermath of contracted work)

  • How are you checking the contents of the subquery? Please include the code you're using. – Jeremy Nottingham Jun 22 '18 at 19:33
  • @JeremyNottingham ah, thanks for the tip, razorsql doesnt know how to render the lookup, so it shows null, nothing wrong with my query after executing in dev console , doh – Jay Rizzi Jun 22 '18 at 19:36

If you use subquery and debug it shows only Parent record. you also run our SOQL query in Query Editor Here it shows the child and Both Record you use following query dev console then show both Record

 List<Contact> conList =[select Id,Name,(SELECT Name, MailingStreet__c FROM Constituent_Addresses__r) from Contact WHERE Id ='0030R00000OsKCjQAN';

 List<Constituent_Addresse__c> acfAddress = conList[0].Constituent_Addresses__r;
 System.debug('List of Address'+acfAddress);

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.