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
satyamsatyam 

Please help to resolve my trigger problem

Hi,

 

In below trigger while updation of record i am checking the new expiration date and old expiration date and if they are not equal then i am updating the field Record_Support_Expiration_Date_Sub_Text1__c but what is the problem its not  working

 

trigger UpdateoldExpirationdateonChange on Record_Support__c (Before update) {
try {
      List<Record_Support__c updateList = new List<Record_Support__c>();
         for (Integer i = 0; i < Trigger.new.size(); i++)   { 
         
            if (Trigger.new[i].Expiration_Date__c != Trigger.old[i].Expiration_Date__c) { 
                System.debug('-------old[i].Expiration_Date__c------------' +Trigger.old[i].Expiration_Date__c);
                 System.debug('-------new[i].Expiration_Date__c------------' +Trigger.new[i].Expiration_Date__c);
                Trigger.new[i].Record_Support_Expiration_Date_Sub_Text1__c=Trigger.old[i].Expiration_Date__c; //remove credit card entries prior to committing data to Salesforce
                 System.debug('------- Trigger.new[i].Record_Support_Expiration_Date_Sub_Text1__c------------' + Trigger.new[i].Record_Support_Expiration_Date_Sub_Text1__c);
                updateList.add(Trigger.new[i]);
            }
         }
     update updateList;
   } catch(Exception e) {
//      System.Debug('removeCCValue Trigger failed: '+e.getMessage()); //write error to the debug log
   }
}

Thanks in advance:))))

 

 

Noam.dganiNoam.dgani

Hi Satyam

 

what is the error?