+ Start a Discussion
hiteshwar marnihiteshwar marni 

A batch apex is called from trigger

Hi All,

A batch apex is called from trigger.If I import records through dataloader do the trigger calls the apex 100 times.How do we handle this situation.I heard that while importing data through dataloader trigger should be deactivated.Is it the accurate solution.
Preya VaishnaviPreya Vaishnavi
Please post your code in which batch apex is called from this trigger
Mahesh K 22Mahesh K 22

trigger sampletgr on account (before insert,before update){
 batchapex1 ba = new batchapex1();
ID jobid = database.executebatch(ba);


Preya VaishnaviPreya Vaishnavi
Please loop through the records and add it to a list and then call the batch apex.Not sure what are you doing with this trigger