Trigger-5

Create a trigger and fetch the variables from Apex Class

trigger Trigger5 on Account (before insert, before update) {
    List<Account> accs=Trigger.New;
    TriggerA tr=new TriggerA();
    tr.calling(accs);
}
// In this program we are fetching the data from Apex class (TriggerA)

Apex class:

public class TriggerA {
    public void calling(List<Account> accs){
        for(Account a:accs){
            if(a.Name !='Hello World')
                a.Name='Hello World';
        }
    }
}
// In this program we are fetching the data from Apex class (TriggerA)

Comments

Popular posts from this blog

Page Layouts

SOQL Scenario-1