How to Debug a Salesforce Flow?
Nullam vel lectus vel velit pellentesque dignissim nec id magna. Cras molestie ornare quam at semper. Proin a ipsum ex. Curabitur eu venenatis
June 21, 2024
671 Views
Creating and debugging flows are an essential part of a salesforce professional these days. But debugging the flows in the right way is more important. In this article we will explore the top three ways to debug a salesforce flow.
Why are Salesforce Flows so Popular?
You may have heard about the fading requirement of Workflow Rules and Process Builders, with Salesforce releasing new tools to help add these features to Salesforce Flow. The major causes for the update are, each tool having overlapping capabilities and business automation requirements are becoming more complicated day by day and the old tools are not capable of fulfilling the requirements. Thus, there was an urgent need to update the automation tools.
Salesforce Flow is our go-to tool when we think about the implementation of analytical automation. Salesforce has been investing a lot in Salesforce Flows over the past couple of years, which makes this tool a lot more powerful and more appealing to admins and developers. The main features of Salesforce flows are:
- Run Processes Asynchronously
- Perform Fast Field Updates (Before Save) or Update Related Records (After Save) in no time.
- Handle complex Process Entry Conditions such as formulas and calculations.
- Provide better error handling, troubleshooting, and debugging.
- Resilience with Invocable Actions and Sub-Flows for repetitive and functionality.
- Provide user interfaces through Screen Flows
- Direct work items to the particular person with Omni-Channel Flows
Also Read
Don’t forget to checkout: Top 10 Best Practices to Use Salesforce Flows.
The Five Main Types of Salesforce Flows
There are five main types of flows provided by Salesforce, it gets new updates and releases every year. Here are the five types of flows:
- Screen Flow
- Record-Triggered Flow
- Auto-Launched Flow
- Scheduled-Triggered Flow
- Platform Event-Triggered Flow
How to Debug Salesforce Flows?
Option 1: Debugging on Canvas
When debugging flows directly on the Flow Builder canvas, this is the most popular way. It works for every type of flow mentioned above except the Platform Event Triggered flow.
Step 1: After creating a stable version of the flow, you will see a “Debug” button at the top of the canvas.
Step 2: By clicking on this button, you can provide the details of any entry criteria that is required, such as a Salesforce Record ID, or by looking up a certain Salesforce record with data that may trigger an action in the flow. Everything depends on the nature of your flow.
Step 3: When the entry criteria is provided, the user will be able to run the flow with the provided data and observe the progress of the flow when it runs through each of the steps, providing you the detailed information on how each of the records are being processed throughout the flow. For a Screen flow, you can go through each screen and provide inputs to test the flow before activating it.
Step 4: While testing the flow in Debug mode, you have many different runtime options will show up by the type of flow being debugged as can be seen below:
Record-Triggered Flow:
- Run as another user
- Provide Input Conditions
- Run in Rollback mode
- Skip Start Conditions
- Run Immediate Path or Run Asynchronous Path
Screen Flow:
- Run as another user
- Provide Input Conditions
Scheduled-Triggered Flow:
- Debug Pause Element
- Run in Rollback mode
Auto-Launched Flow:
- Run as another user
- Provide Input Conditions
- Debug Pause Element
- Run in Rollback mode
Omni-Channel Flow:
- Run as another user
- Provide Input Conditions
- Run in Rollback mode
Option 2: Record-Triggered Flow Debugging Using Reusable Test Cases
The other way to debug a flow is to take action at the time an error while running the flow occurs.
Step 1: The user who last worked on the flow will receive an email whenever any user in the system encounters an error with that flow. This is a setting provided by Salesforce.
Step 2: You can update it in Process Automation Settings to send the error email to all Apex Exception Email recipients.
Step 3: The message that the recipient will receive is an email from Salesforce support outlining the runtime of the flow on which specific point the flow failed on, and some details about the cause of the error, such as “Incorrect ID” type and “Unexpected Null Value”, which the admin can then use to check the issue with the flow.
Step 4: Apart from this, the email will also have a link to the failed flow version which will redirect the admin to the flow canvas to check the error that occurred.
These failed flow versions can also be viewed from the Salesforce Setup by searching for Paused and Failed Flow Interviews where a list of both paused and failed flows is saved.
Option 3: Debugging Record-Triggered Flows with Reusable Test Cases
The third way of debugging flows is a newly released option by Salesforce which is currently available for Record-Triggered flows only; it allows users to create reusable test cases.
The test cases for Record-Triggered flows can be created in two ways within the flow canvas.
Step 1: Debug the flow on the canvas, just the way it is mentioned in option 1.
Step 2: When running a debug case on a Record-Triggered flow after successful completion, you will see a button to Convert to Test, by clicking on it you can asily convert it.
This trigger will take the input values provided by the active user and save the debug case as a test case, then it can be used to run against future versions of the flow to ensure the runtime is still operating the way you wanted.
Bottom Line
Those were the top three ways to debug a flow. The first one is the finest and easiest of all. To read more such blogs on Salesforce, keep following our articles.
- Share this article
Contributor of the month
Mithun Naik
Software Engineer | Salesforce | 3X Certified Developer | Salesforce Blog Writer
Categories
Most Viewed Posts
Boost Your Brand's Visibility
Want to promote your products/services in front of more customers?
Explore More Blogs
Default title
This will close in 0 seconds