Invoke Apex Class from Trigger #inSalesforce

Invoke Apex Class from Trigger #inSalesforce


public class SampleClass{
    public void SampleMethod(List<Account> listAccount, Map<Id, Account> mapAccount){
    }
}


trigger SampleAccount on Account (before insert){
    for(Account a : trigger.new){
        SampleClass objt = new SampleClass(trigger.new, trigger.newmap);
        objt.SampleMethod();
    }
}

Comments