+ Start a Discussion

Please help to resolve my trigger problem



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);
     update updateList;
   } catch(Exception e) {
//      System.Debug('removeCCValue Trigger failed: '+e.getMessage()); //write error to the debug log

Thanks in advance:))))




Hi Satyam


what is the error?