Set Up Apex Exception Email Notifications

Salesforce sends two types of notification mails when potential issues with APEX code are detected:

  • APEX warning mails, which are sent when a class or trigger exceeds 50% of an APEX governor limit.
  • APEX exception mails, which are sent when an unhandled exception occurs in a trigger or class.

Before winter’16 when an Apex code encounters unhandled exception it sends the exception email to LastmodifiedBy user email address of the class or trigger. Now we can also notify users of the Salesforce org and arbitrary email addresses.

To set up these email notifications follow below steps:

Go to Setup || Email Administration || Apex Exception Email || Add Salesforce User or Add Non Salesforce User email address. || Click Save.

After setup “Apex Exception Email”, Now if any apex exception occurs on the Salesforce org by any user then this defined user will receive an apex exception email.