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
prathap cprathap c 

can any one explain about difference between trigger.new and trigger.old in update trigger?

PratikPratik (Salesforce Developers) 
Hi Prathap:

Trigger.new : Returns a list of the new versions of the sObject records. Note that this sObject list is only available in insert and update triggers, and the records can only be modified in before triggers.
 
Trigger.old : Returns a list of the old versions of the sObject records. Note that this sObject list is only available in update and delete triggers.

Go through this post:
https://developer.salesforce.com/forums/ForumsMain?id=906F00000008yMCIAY

Thanks,
Pratik

P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
sfdc550sfdc550

Trigger.new returns new value of records and Trigger.old returns old value of records. Trigger.new works in case of insert and update both and Trigger.old works in case of update and delete both. For update you can use both as per your need.
 
trigger myTest on Scheme__c(after insert){
       for(Scheme__c sc : Trigger.new){
            // Trigger.new will return new value of records.
      }
}




Lets Take a Example: In Case of update and delete and undelete
 
Lets suppose Ammount__c field have current value equal 2000 and in updation user        provide Ammount__c = 3000 Than.....

trigger myTest on scheme__c(after update,after delete,after undelete){
    for(Scheme__c sc : Trigger.old){
       System.debug('========='+sc.Ammount__c); // will return 2000
    }
    for(Scheme__c sc : Trigger.new){
         System.debug('==========='+sc.Ammount__c); // will return 3000

    }

}