• angelch
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi all,

I have developed a trigger (before insert, before update) on Lead object that calls a method inside a class for sending a list of emails. The trigger is fired when a batch filter and process a big amount of records uploaded through Data Loader. Depending on the number of records inserted on Lead object, email limit is reached (System.LimitException: Too many Email Invocations: 11). 

I have seen in the debug log that the trigger is fired too many times, but it has been written following best practices advices to avoid this kind of issue. It seems to be records are been processed in packages of 200. In fact, when I try to insert more than 400 records the exception is shown (I'm using also some workflow rules that cause the trigger is executed one more time). I have read about it in other forum discussions, but the new API theoretically solved this problem for Bulk triggers. 

Could you give me any advice to solve this problem?

Thanks in advance.