Sunday, June 30, 2024

Apex Class

 

Class

public class AccountUtils {

    public static list<Account> accountsByState(String state){

        List<Account> listAcc=[select ID,name from Account where BillingState=:state];

        return listAcc;        

    }

}



Developer console

list<Account> lacc=new list<Account>();

lacc=AccountUtils.accountsByState('NC');

system.debug('**lacc'+lacc);

No comments:

Post a Comment