function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sagarrrrsagarrrr 

System.debug the following statements for all events (Before & After) a)Trigger.New b) Trigger.Old c)Trigger.NewMap d)Trigger.oldMap

i am new for trigger please help me 
Thanks in advance
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi saurabh,
All these are  trigger context variables.These variables are contained in the System.Trigger class.
Please refer below links which might help you in this.
https://developer.salesforce.com/forums/?id=9060G0000005ixrQAA
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_context_variables.htm

Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards
Anurag Reddy KanchimireddyAnurag Reddy Kanchimireddy
Hi Saurabh,
Go through this document https://www.iterativelogic.com/salesforce-apex-trigger-best-practices/  and post if u need any further assistance. 
sagarrrrsagarrrr
Hi Devi, 
Thanks For Your Help
sagarrrrsagarrrr
Hi Anurag,
Thanks For Your Help
 
Vennila Paramasivam 1Vennila Paramasivam 1
Hi Saurabhh,

Since you are new to Trigger, It's time to learn Trigger Factory. 
Please visit the below link for Trigger Best Practice and usage of Trigger Factory.
https://debugonweb.com/2019/01/27/trigger-factory-salesforce/

For debugging trigger,
http://www.infallibletechie.com/2015/10/how-to-cover-adderror-in-trigger-in.html
pratiksha mogal 6pratiksha mogal 6
// hello everyone if you find it helpful then please mark as best ans
trigger AllEventstrigger on Account (before insert,before update,before delete,after insert,after update,after delete) {
            if (trigger.isBefore){
            if (trigger.isInsert){
           AllEvents_Account('Before','Insert');
            }else if (trigger.isupdate){
               AllEvents_Account('Before','Update');
            }else if (trigger.isdelete){
              AllEvents_Account('Before','delete');  
            }else{
            }
            }
    if (trigger.isAfter){
        if (trigger.isInsert){
           AllEvents_Account('After','Insert');
            }else if (trigger.isupdate){
               AllEvents_Account('After','Update');
            }else if (trigger.isdelete){
              AllEvents_Account('After','delete'); 
            }else{
    }
    } 



   public static void AllEvents_Account(string s1,string s2){
    system.debug(s1+'---'+s2+'--trigger.new--'+ trigger.new);
    system.debug(s1+'---'+s2+'--trigger.old--'+ trigger.old);
    system.debug(s1+'---'+s2+'--trigger.newmap--'+ trigger.newmap);
    system.debug(s1+'---'+s2+'--trigger.oldmap--'+ trigger.oldmap);
}
}