Activity Forums Salesforce® Discussions How to debug the child values in parent to child query using for loop? Reply To: How to debug the child values in parent to child query using for loop?

  • Naman

    Member
    April 21, 2016 at 8:14 am

    What error you are getting in second for loop?

    As multiple contacts could be associated with single account so, to traverse the contact you would need second for loop inside first. Debug contact values in second for loop. you can do like:

    for(Account aa:accs){
    System.debug(aa.id);
    System.debug(aa.name);
    System.debug(aa.phone);

    for(Contact con:accs.contacts){

    System.debug(con.email);

    }
    }