Loading

Salesforce Platform: Set up Apex Exception Email notifications

Publiceringsdatum: Mar 25, 2026
Beskrivning

Is there a way to change who receives Apex exception mails?

Salesforce Classic: Setup | Quick find | Apex Exception Email
Lightning Experience: Gear Icon | Setup | Quick find | Apex Exception Email

Add Salesforce User or Add Non Salesforce User email address | Click Save

The entered email addresses then apply to all managed packages in the customer's org. 

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. 

 

You can also configure Apex exception emails using the Tooling API object ApexEmailNotification.

Example Scenario

A development team has deployed a custom Apex trigger to production that processes incoming lead records. One evening, a data import creates records that expose an edge case in the trigger's logic, causing an unhandled exception. Without Apex Exception Email configured for the team's shared inbox, only the individual developer who last modified the trigger receives the error notification — and they are on leave. By the time the issue is discovered the next morning, hundreds of lead records have failed to process. Configuring Apex Exception Email to notify a shared team inbox or a dedicated on-call email address ensures that production Apex errors are caught and triaged immediately, regardless of individual availability.

Lösning

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
  1. Configure email addresses that receive emails when your Apex code encounters unhandled exceptions. Previously, these emails were sent only to the developer who’d last modified a failing class or trigger. Now you can also notify users of your Salesforce org and arbitrary email addresses.
  2. Unhandled exception emails are sent by default to the developer specified in the LastModifiedBy field on the failing class or trigger. In addition, you can have emails sent to users of your Salesforce org and to arbitrary email addresses.
NOTE : To protect the privacy of your data, make sure that test error messages and exception details don’t contain any personally identifiable information (PII). The Apex exception handler and testing framework can’t determine if sensitive data is contained in user-defined messages and details. To include personal data in custom Apex exceptions, we recommend that you create an Exception subclass with new properties that hold the personal data. Then, don’t include subclass property information in the exception's message string. Unhandled exception emails are sent to the developer specified in the LastModifiedBy field on the failing class or trigger or who are added to the Apex Exception mail list, even if they are an inactive user.


See also:
What Happens When an Apex Exception Occurs?   

Control Who Receives Flow and Process Error Emails   
 
Knowledge-artikelnummer

000385876

 
Laddar
Salesforce Help | Article