Smart Ways to Debug Salesforce Flows with Asynchronous Apex methods

By | July 1, 2025

Debug Salesforce Flows with Asynchronous Apex is an essential skill for Salesforce admins and developers. While debugging standard Flows is usually straightforward—until asynchronous Apex enters the picture. When you debug Salesforce Flows with Asynchronous Apex (such as Queueable, @future, or Batch classes), execution shifts to the Apex job queue. This blog will guide you through how to debug Salesforce Flows with Asynchronous Apex using real-world scenarios, step-by-step instructions, and effective tools.

In this blog, we’ll explore:

  • A real-world example where a Flow triggers a Queueable Apex class.
  • Step-by-step guidance on how to effectively debug asynchronous behavior.

Architecture Overview

This section covers the system architecture used to debug Salesforce Flows with Asynchronous Apex components:

  • A Record-Triggered Flow runs on the Account object.
  • The Flow passes the Account Id to an Invocable Apex method.
  • The method collects the IDs and triggers a Queueable Apex class.
  • The Queueable class performs logic (e.g., data retrieval or processing) and logs the outcome.

This design is useful when:

  • You want to shift heavy logic from Flow to Apex for performance reasons.
  • You’re handling long-running operations (e.g., bulk processing, API calls).
  • You need to trigger everything from a declarative Flow.

Code Overview

  1. Queueable Apex Class: Handles the main logic asynchronously.
Queueable Class
Queueable Class
  1. Invocable Apex Class: Exposes the Queueable trigger method to Flows.
Invocable Class
Invocable Class
  1. Record-Triggered Flow: Starts the process based on changes to an Account.
Record-Triggered Flow
Record-Triggered Flow

Step by Step Debugging Guide

To debug Salesforce Flows with Asynchronous Apex, follow these 5 practical steps:

  1. Enable Debug Logs for the User
    • Go to Setup → Debug Logs
    • Add the user triggering the Flow
    • Set the following log levels:
      • Apex Code: FINE
      • System: DEBUG
  2. Trigger the Flow
    • Create or update an Account record
    • This starts the Flow, which invokes the Apex method
    • The method enqueues a Queueable job
  3. Review the Initial Flow Log
    • Go back to Debug Logs
    • Open the first log related to the Flow execution
    • Confirm the Flow successfully called the Invocable Apex method
Initial execution (Invocable Class)
Initial execution (Invocable Class)
  1. Monitor the Queueable Job
    • Navigate to Setup → Apex Jobs
    • Look for the job with type Queueable
    • Check its status (e.g., Completed or Failed).
Apex Job
Apex Job
  1. Inspect the Queueable Execution Log
    • Return to Debug Logs
    • Open the second log corresponding to the Queueable job
    • Review System.debug() outputs to verify execution details
Queueable Log
Queueable Log

Conclusion

Debugging asynchronous Apex triggered from Flows can feel like chasing ghosts but it doesn’t have to be. With proper debug log setup, Apex job tracking, and structured logs, you can confidently monitor and verify every step of the execution.

By following the above blog instructions, you will be able to learn “How to Debug Salesforce Flows with Asynchronous Apex Methods”. If you still have queries or any related problems, don’t hesitate to contact us at salesforce@greytrix.com. More details about the Product are available on our website and Salesforce AppExchange.

We hope you may find this blog resourceful and helpful. However, if you still have concerns and need more help, please contact us at salesforce@greytrix.com.

About Us
Greytrix – a globally recognized and one of the oldest Sage Development Partner and a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners and Sage PSG across the globe. We offer Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that require apex code incorporation into the Salesforce platform.

Greytrix has some unique solutions for Cloud CRM such as Salesforce Sage integration for Sage X3Sage 100 and Sage 300 (Sage Accpac). We also offer best-in-class Cloud CRM Salesforce customization and development services along with services such as Salesforce Data MigrationIntegrated App developmentCustom App development and Technical Support business partners and end users.
Salesforce Cloud CRM integration offered by Greytrix works with Lightning web components and supports standard opportunity workflow. Greytrix GUMU™ integration for Sage ERP – Salesforce is a 5-star rated app listed on Salesforce AppExchange.

The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for processing and execution of application programs at the click of a button.

For more information on our Salesforce products and services, contact us at salesforce@greytrix.com. We will be glad to assist you.

Related Posts