0

I would like to show Accounts and Related Contacts in a Picklist.

public class mappingaccount1 {
  public List<SelectOption> mapcon { get; set; } 
  public List<Contact> mapcon { get; set; } 
  public Map<Account, List<Contact>> mapconn { get; set; } 

  public mappingaccount1(){
    mapconn = new Map<Account, List<Contact>>();
    List<Account> lstacc= [SELECT Id, Name, (SELECT Id, Name FROM Contact) FROM Account];

    for(Account a : lstacc) {
      List<SelectOption> mapcon = [SELECT id,name FROM Contact WHERE AccountId =:a.id];

      mapcon.put(a,lstcon);
    }
  }
}

1 Answer 1

0

An org might have 10,000 Accounts and 10,000,000 Contacts. Unless you can guarantee that there will only ever be a few hundred of each object in your target org you should re-think your design.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .