View Apex Trigger Details

Apex triggers are stored as metadata in the application under the object with which they are associated.

Required Editions

Available in: Salesforce Classic (not available in all orgs) and Lightning Experience
Available in: Enterprise, Performance, Unlimited, Developer, and Database.com Editions
User Permissions Needed
To edit Apex triggers: Author Apex
To view Apex triggers: View Setup and Configuration

You can also view all triggers in Setup by entering Apex Triggers in the Quick Find box, then selecting Apex Triggers.

You can add, edit, or delete Apex using the Salesforce user interface only in a Developer Edition organization, a Salesforce Enterprise Edition trial organization, or sandbox organization. In a Salesforce production organization, you can change Apex only by using the Metadata API deploy call, the Salesforce Extensions for Visual Studio Code, or the Ant Migration Tool. The Salesforce Extensions for Visual Studio Code and Ant Migration Tool are free resources provided by Salesforce to support its users and partners, but are not considered part of our Services for purposes of the Salesforce Main Services Agreement.

  • To view the details for a trigger, from Setup, enter Apex Triggers in the Quick Find box, then select Apex Triggers, then click the name of the trigger. You can also access the trigger details from the object management settings for an object.
  • From the trigger detail page, you can:
    • Click Edit to modify the contents of the trigger.
      Note
      Note A Managed - Installed icon indicates that an Apex trigger is in an installed managed package. You cannot edit or delete a trigger in a managed package.
    • Click Delete to delete the trigger from your organization.
    • Click Show Dependencies to display the items, such as fields, s-controls, or classes, that are referenced by the Apex code contained in the trigger.
    • Click Download Apex to download the text of the trigger. The file is saved with the name of the trigger as the file name, with the filetype of .trg.

The trigger detail page shows the following information for a trigger:

  • The name of the trigger
  • The name of the object with which the trigger is associated, such as Account or Case.
  • The API version that the trigger has been saved against.
  • Whether a trigger is valid.
    Note
    Note Triggers are stored with an isValid flag that is set to true as long as dependent metadata has not changed since the trigger was last compiled. If any changes are made to object names or fields that are used in the trigger, including superficial changes such as edits to an object or field description, the isValid flag is set to false until the Apex compiler reprocesses the code. Recompiling occurs when the trigger is next executed, or when a user resaves the trigger in metadata.

    If a lookup field references a record that has been deleted, Salesforce clears the value of the lookup field by default. Alternatively, you can choose to prevent records from being deleted if they’re in a lookup relationship.

  • Whether the trigger is active.
  • The text of the Apex code contained in the trigger.
  • If trigger references components in installed managed packages, such as an Apex class, a Visualforce page, a custom object, and so on, the Version Settings section lists the package versions of the packages containing the referenced components.
  • If the trigger is contained in an installed managed package, the Installed Package indicates the package name.

The Log Filters tab displays the debug log categories and debug log levels that you can set for the trigger. For more information, see Debug Log Filtering for Apex Classes and Apex Triggers.