Read the screenplay: FANNIEGATE — $7 trillion. 17 years. The biggest fraud in American capital markets.
🔄 FlowsIntermediate2026-03-04

Debugging Flows Like a Developer: Beyond the Debug Log

Most admins debug flows by clicking "Debug" in Flow Builder and stepping through manually. That works for simple flows, but the moment you have subflows, record-triggered flows, or platform events, the built-in debugger falls apart. You need a real strategy.

The trick is to use custom debug actions. Create a reusable subflow called "Debug_Logger" that accepts a text input and creates a custom object record (Flow_Debug_Log__c) with the timestamp, flow name, and variable values. Wire it into your flows behind a custom metadata toggle (Flow_Debug_Settings__mdt) so you can turn logging on and off without editing the flow. In production, the toggle is off and there is zero performance cost.

Pair this with Setup > Debug Logs filtered to "Workflow" category for record-triggered flows. The debug log shows you the exact order of execution: validation rules, before-save flows, after-save flows, and process builders. When flows interact with each other, this execution order is the only way to find the real problem.

Code Example

// Flow_Debug_Log__c custom object:
// - Flow_Name__c (Text)
// - Message__c (Long Text)
// - Variable_Snapshot__c (Long Text)
// - Timestamp__c (DateTime)

// In your flow:
// 1. Get Records: Flow_Debug_Settings__mdt
//    WHERE DeveloperName = "Default"
// 2. Decision: Is {!debugSettings.Enable_Logging__c} = TRUE?
//    YES → Subflow: Debug_Logger
//      Input: flowName = "My_Record_Triggered_Flow"
//      Input: message = "Entry criteria met"
//      Input: snapshot = {!$Record.Name} & " | " & TEXT({!$Record.Amount})
//    NO → Continue without logging

// Toggle logging in production:
// Setup → Custom Metadata → Flow_Debug_Settings → Enable_Logging = true
// (No deployment needed, no flow edit needed)

Need this implemented in your org?

I've shipped these patterns in production for 10+ years.

View Consulting →

Enjoyed this? Get more like it.

Glen's Musings — AI, investing, and building things. Occasional. Free.

More Flows Tips