Skip to content

Instantly share code, notes, and snippets.

@dancinllama
Created January 16, 2015 21:18
Show Gist options
  • Save dancinllama/8f789e759dda1ce0a883 to your computer and use it in GitHub Desktop.
Save dancinllama/8f789e759dda1ce0a883 to your computer and use it in GitHub Desktop.

Revisions

  1. James Loghry created this gist Jan 16, 2015.
    20 changes: 20 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    List<Account> accList = new List<Account>(
    [Select
    Id
    ,Name
    ,(Select
    Email
    From
    Contacts
    )
    From Account]
    );

    for(Account acc : accList){
    Integer numWithEmail = 0;
    for(Contact cont : acc.Contacts){
    if(!String.isEmpty(cont.Email)){
    numWithEmail++;
    }
    }
    }