I have list of custom + child records (SOQL with inner select). I passed this list to array attribute in Lightning component. I can iterate through child records using aura:iteration in my component but I can't get this array in javascript 'for' loop using relationship. Any ideas?

As an example if we have list of accounts with contacts I want to get contacts using Account.Contacts in for loop of accounts.

  • seems like someone else did that with opp.OpenActivities see the last comment. try to console.log your parent object, and see where it is hiding it's children records – Basti Nov 9 '17 at 16:06
  • I'm getting 'undefined' in console log. That is the reason why I asked this question actually ;) – Eugene Vabishchevich Nov 9 '17 at 16:09
  • 1
    So even your account (or equivalent) is undefined? if so, please post your component code so it's easier to find the error. – Basti Nov 9 '17 at 16:11
  • @Basti seems like I can't get them after sort function. That is how I use it: accontsArray.sort(function(a,b){ return new Date(a.CreatedDate) - new Date(b.CreatedDate); }); – Eugene Vabishchevich Nov 9 '17 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.