Skip to main content
1 Antwort
  1. 3. Nov. 2022, 13:41
    HI Piyush,

    If you are looking for an apex method that accepts account name and Returns the list of contacts for that account, try

     

    public class PassAccount {

    public static List<Contact> getcontact(String Name){

    List<Contact> conlist=[select id, Name , Accountid from Contact where account.name=:name];

    return conlist;

    }

    }

    Call this method in anonymous block as 

    List<Contact> con=PassAccount.getcontact(‘huuu’);

    system.debug(‘asa’+con);

    If this information helps, please mark the answer as best. Thank you

     
0/9000