LogoLogo
TrustAPI Docs
  • Application
  • Support
  • Platform
  • Infrastructure
  • Security
  • Notices
  • Overview
  • Protect Data
    • Auto Backup
      • Auto Backup API Usage
      • Supported Objects
      • Delete Tracking
      • Salesforce Metadata Backup
      • Missing Field Permissions
      • Viewing Records
      • Viewing Files
    • Archive
      • Support for Big Objects
    • Restore
      • Restore Best Practices
    • Purge
  • Reuse Data
    • Global Search
    • Data Lake (formerly History Stream)
      • AWS Data Lakehouse
      • DuckDB Data Lake
      • Heroku Data Lakehouse
      • Azure Data Lake
      • Data Lake FAQ
      • Data Lake v1 (formerly History Stream)
    • Salesforce Sandbox Seeding
      • Sandbox Seeding Walkthrough
    • Public API
    • Managed Package
      • Second Generation
        • Features
        • Install
        • Update
        • Uninstall
      • First Generation
        • Features
        • Configure
        • Uninstall
        • Migrate
      • Frequently Asked Questions
  • Other
    • Settings
      • Connecting Salesforce
      • Connecting Storage
      • Sandbox Refresh
    • Notifications
    • Permissions
      • Integration User
      • Integration User Scripts
    • Troubleshooting
      • Debugging Salesforce Triggers
    • Auto Updates

Copyright © 2025 GRAX, Inc.

On this page
  • When to Debug Triggers
  • How to Debug Triggers
  • Debugging System Mode Operations
  • Support for Triggers

Was this helpful?

Export as PDF
  1. Other
  2. Troubleshooting

Debugging Salesforce Triggers

Last updated 1 month ago

Was this helpful?

Salesforce Triggers within customer orgs can cause issues with Archive and Restore functionality for a number of reasons. Triggers represent arbitrary code execution in the midst of GRAX interacting with data; their effects can be unpredictable and destabilizing. This document provides guidance on how to debug Triggers that may be causing issues with GRAX.

When to Debug Triggers

Debugging of Triggers may become necessary when:

  • Archive or Restore jobs are failing due to Apex CPU timeouts.

  • Archive or Restore jobs are failing due to Apex governor limits.

  • Archive or Restore jobs are failing due to unhandled exceptions in Apex code.

  • Archive or Restore jobs are failing due to integrity/validation errors on unrelated records/objects.

How to Debug Triggers

Trace Flags are the most powerful tool for debugging triggers. They allow you to review the execution of your code after the fact at a low level, and can be used to identify the root cause of issues including where in the Trigger code the problem is occurring. For information on how to set a Trace Flag for a given user, class, or trigger, see the .

Note the following:

  • Most triggers and automation in Salesforce run in "System Mode" and will not be affected by Trace Flags scoped to the user that triggers the operation. To capture logs for these automated operations, you must set a Trace Flag for the System user. See below for more information.

  • Class and Trigger flags only override user-scoped flags, if set, and will not enable logging on their own. Enable flagging for the user in question first.

  • Trace Flags are not retroactive. They must be set before the code is executed to capture the log.

  • Trace Flags are not permanent. Ensure that your flags have not expired when reproducing issues to avoid missing logs.

Debugging System Mode Operations

To debug operations that run in System Mode, you must set a Trace Flag for the System user. The System user does not show up in the Salesforce GUI in any context, meaning the API must be used to set the Trace Flag. The following steps outline how to set a Trace Flag for the System user:

  1. Use the Salesforce Developer Console to query for the System user ID. The System user's "name" is always 'System': SELECT Id FROM User WHERE Name = 'System'.

  2. Use the Salesforce Developer Console (in "Tooling API" mode) to query for the Debug Level ID you wish to use: SELECT Id, DeveloperName FROM DebugLevel. The lowest possible level of logging is recommended.

Support for Triggers

Use Workbench to set a "USER_DEBUG" trace flag for the System user. Documentation on this process can be found .

GRAX Support cannot directly support the debugging, interpretation, or modification of Customer triggers or automation unrelated to GRAX products. If you require assistance with debugging your triggers beyond the information above, please consult with your Salesforce Administrator and Developer resources, then reach out to Salesforce's Customer Support team for further assistance. If you require assistance related to the GRAX product, please .

related Salesforce documentation
here
reach out to GRAX Support