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
SarikaPSarikaP 

Trigger not fired when record updated using dataloader

I am trying to mass update records using dataloader. Once a record is updated, the trigger should be fired. I tried to update records but the trigger is not fired when used dataloader. When I manually update the record, the trigger is fired. Here's my code:
Trigger
    if(trigger.isafter && (trigger.isinsert || trigger.isupdate))
      {         
            UpdateExpirydate.UpdateCertDetails(Trigger.new);
      }
Apex controller:
   public static void UpdateCertDetails(List<Certification_Attendees__c> lstcertattendees)
{
    
        List<String> cerType = new List<String>{'Certification','Exam Retake','Recertification'};
        List<String> certLevel = new List<String>{'1','2','3'};
        List<Contact> lstcontacts = new List<Contact>();
        Set<Id> contactIds = new Set<ID>();
        if(lstcertattendees != null && lstcertattendees.size() > 0)
        {
            for(Certification_Attendees__c att : lstcertattendees)
            {
            contactIds.add(att.Attendee__c);
            }
            System.debug('ContactIds' + contactIds.size());
            if ( contactIds != null && contactIds.size() >0)
            {
                    for(Certification_Attendees__c attendee : [Select c.Name, c.Level__c , c.Attendee__c,c.Certified_on__c,c.Expiry_Date__c,c.Type__c,c.Exam_Result__c   from Certification_Attendees__c c where c.Attendee__c in: contactIds and
                    c.Exam_Result__c =: 'Passed' and c.Type__c in: cerType and c.Level__c in: certLevel order by c.Certified_on__c desc LIMIT 1])
                {
                     if(attendee != null)
                     {
                     Contact con = new Contact();
                     con.Id = attendee.Attendee__c;
                     con.Certified_On__c = attendee.Certified_on__c;
                     con.Expiry_Date__c = attendee.Expiry_Date__c;
                    lstcontacts.add(con);
                    }
                }   
            }
        System.debug('lstcontacts.size()' + lstcontacts.size());
            if(lstcontacts !=null && lstcontacts.size() > 0)
            {   
                    update lstcontacts;
                 system.debug('Certification details on Contact Records updated successfully');
            }
        }

}

Thanks in advance!
Raj VakatiRaj Vakati
It will be not the case .. When you update the dataloader it will fire the trigger .. 

Please check this 
  1. Do you have any custom code to by pass the trigger ? like By pass trigger to true at user level ? 
  2. Any other code to do it.. 
SANKET KUMAR 28SANKET KUMAR 28
Make your trigger fire before update or insert takes place. You are firing the trigger after insert and after update.
Have a look:-
There are two types of triggers:
  • Before triggers are used to update or validate record values before they’re saved to the database.
  • After triggers are used to access field values that are set by the system (such as a record's Id or LastModifiedDate field), and to affect changes in other records, such as logging into an audit table or firing asynchronous events with a queue. The records that fire the after trigger are read-only.