Run a Check from Flow
Run a Record Health Check Set or a single Check from a Salesforce Flow and branch on the result, without writing Apex. Record Health Check provides two Flow actions that evaluate a record and return its status, so a Flow can, for example, notify an Account owner when the Account’s Checks fail.
Choose the action
Section titled “Choose the action”Flow Builder lists both actions in the Record Health Check category.
| Action | Runs | Returns |
|---|---|---|
| Run Record Health Check Set | Every active Check in one Check Set | An overall Status, a count for each result, and Result JSON |
| Run Record Health Check | One Check | The Check’s Status, its Reason Code, and Result JSON |
Use Run Record Health Check Set when a Check depends on a Prerequisite Check. A single-Check request evaluates the selected Check without its prerequisite.
Example used in this guide
Section titled “Example used in this guide”A record-triggered Flow runs when an Account’s Rating changes to Cold. It runs the
Account_Data_Quality Check Set for that Account. When the result is FAIL, the Flow creates a Task
for the Account owner to review the Account; otherwise it ends.
Before you start
Section titled “Before you start”- Create, activate, and test the Check Set on the record-page card. See Configure Check Sets and Checks.
- Copy the Check Set’s API name: in Setup, open Custom Metadata Types → Record Health Check Set →
Manage Records, open the Check Set, and copy its Record Health Check Set Name. A Check Set
your organization created has no prefix, such as
Account_Data_Quality. A Check Set that installs with the package has therhc__prefix, such asrhc__Example_Account_Check_Builder_Guide. - Identify the user whose action starts the Flow. Record Health Check evaluates as that user, with that user’s record and field access, even when the Flow itself runs in system context. Assign Record Health Check User to the users who start the Flow, and confirm they can read the records and fields that the Checks use.
- Decide whether another process must also receive the result as a Platform Event. If not, you use
NONE.
Build the Flow
Section titled “Build the Flow”-
In Setup, enter
Flowsin Quick Find, select Flows, and then select New Flow. -
Select Record-Triggered Flow. Set Object to Account, trigger the Flow when a record is updated, and set the entry condition Rating equals Cold. Under Optimize the Flow for, select Actions and Related Records, so the Flow runs after the record is saved and the Checks read the saved values.
-
Add an Action element. Search for
Run Record Health Check Setand select it. -
Set the inputs:
Input Value Check Set Qualified API Name Account_Data_ Quality Record ID {!$Record.Id} Event Publication NONE -
Add a Decision element named Request succeeded? after the action. Add an outcome Succeeded where the action’s Success output equals
true. The default outcome handles a rejected request. -
On the Succeeded path, add a Decision element named Result with an outcome for each status your Flow handles. For this example, add Failed where Status equals
FAIL. -
On the Failed path, add a Create Records element that creates a Task for
{!$Record.OwnerId}with Related To set to{!$Record.Id}. -
On the default outcome of Request succeeded?, record the action’s Error Type and Error Message in the way your organization handles automation errors.
-
Connect the action’s fault path to your organization’s Flow fault handling. It runs only when a Salesforce error stops the action from returning outputs.
-
Save the Flow, debug it, and then activate it.
Read the results
Section titled “Read the results”| What the action returns | Meaning | What the Flow should do |
|---|---|---|
Success is false | The request was rejected, for example because of an unknown API name. | Read Error Type and Error Message. Ignore Status. |
Status is PASS | The record meets the requirements. | Continue. |
Status is FAIL | The record does not meet a requirement. This is not a Flow error. | Take the business follow-up action. |
Status is SKIPPED | The Checks did not apply to the record. | Continue, or handle separately. |
Status is UNABLE_ | Access, configuration, or data prevented a reliable answer. | Route for an administrator to review. |
Status is ERROR | An unexpected problem stopped a Check. | Route for technical investigation. |
| The fault path runs | A Salesforce error stopped the action before it returned outputs. | Use your Flow fault handling. |
For a Check Set, Status is the most serious result among its Checks, in this order: ERROR,
UNABLE_TO_EVALUATE, FAIL, PASS, SKIPPED. A Check Set where three Checks pass and one fails
returns FAIL. Use the count outputs, such as Failed Count, when the Flow needs to know how many
Checks had each result.
Never send FAIL, UNABLE_TO_EVALUATE, or ERROR to the fault path. They are results, not errors,
and the Flow interview completes normally.
Test the Flow
Section titled “Test the Flow”- Select Debug, choose an Account that fails a Check, and run the Flow. Confirm that it follows the Failed path and creates the Task.
- Debug with an Account that passes every Check, and confirm that the Flow ends without a Task.
- Debug with an API name that does not exist, and confirm that the default outcome of Request
succeeded? runs with Error Type
VALIDATION. - Run the Flow as a user with the same access as the real users. If your org allows it, select Run flow as another user in the Debug options. The result can differ from an administrator’s, because Record Health Check reads data with the running user’s access.
Limits
Section titled “Limits”- Salesforce can send many records to one action call, such as when a data load updates many Accounts. The records are grouped by Check or Check Set and Event Publication value. One call can contain at most 10 groups, and each group at most 200 records.
- A Check Set with more than 25 active Checks returns Success
falsewith Error TypeLIMIT, and no Check runs. - The Result JSON of all records in one call can total at most 2,000,000 characters. Records past
that point return Success
falsewith Error TypeLIMIT. - Formula Checks are limited to 95 formula evaluations per transaction, about one per record per Formula Check or Applies When (Formula). A large data load can exceed it; see Platform limitations.
Resolve problems
Section titled “Resolve problems”| What you see | What to check |
|---|---|
| The action is not in Flow Builder | Record Health Check is installed, and you are searching the Record Health Check category. |
Error Type is AUTHORIZATION | The Flow’s running user has Record Health Check User. |
Error Type is VALIDATION | The API name is exact and active, Record ID is set, and Event Publication is NONE, ACTIONABLE, or ALL. |
Status is UNABLE_ | The running user’s access to the objects and fields the Checks read. |
| The Flow and the card give different results | The users and their access. See Troubleshoot execution context. |