Check that the high-priority Case backlog is within a limit
Create a Record Health Check that counts an Account’s open Cases with Priority set to High and
passes when there are three or fewer. The example uses the Verify with a query Evaluation Type
with a COUNT() query, and shows how to publish the result as a Platform Event when a user selects
Run.
Why a query fits
Section titled “Why a query fits”Cases are related records and the requirement is a count, so one COUNT() query answers it. A Check
gives service context on the Account without blocking Case saves.
Before you start
Section titled “Before you start”- Install Record Health Check, and assign yourself Record Health Check Admin and the Salesforce Customize Application permission.
- Confirm that
Highis the Case Priority value your org uses, in Setup → Object Manager → Case → Fields & Relationships → Priority. - Replace the limit of three with your approved number.
- Confirm that the people who will use the card can read Cases and their Priority and Closed fields.
Step 1: Create or choose the Check Set
Section titled “Step 1: Create or choose the Check Set”Use the Account Related Record Review Check Set from Check that an Account has at least one Contact, or any active Account Check Set.
Step 2: Create the Check
Section titled “Step 2: Create the Check”Open Setup → Custom Metadata Types, select Manage Records next to Record Health Check, select New, enter these values, and save.
| Field | Value |
|---|---|
| Label | High-Priority Case Limit |
| Check Set | Account Related Record Review |
| Evaluation Type | Verify with a query |
| Record Health Check Name | High_ |
| Evaluation Order | 70 |
| Active | Cleared until validation succeeds |
| Source Query | SELECT COUNT() FROM Case WHERE AccountId = {!record. |
| Source Query Field | Leave blank |
| How To Read Query Results | One row or aggregate |
| Comparison Operator | At most |
| Expected Value Comes From | Fixed value |
| Expected Value (Fixed) | 3 |
| Check Title | High-priority Case backlog is within the limit |
| Check Description | Passes when the Account has three or fewer open high-priority Cases. |
| Message When Failed | {!record. |
| Fix Message | Review the owner and response plan for each open high-priority Case, and escalate if needed. |
| Message When Unable To Evaluate | Unable to count high-priority Cases. |
| Failure Severity | Warning |
| Action Label | Review Cases |
| Action URL | /lightning/r/Account/{!record. |
| Applies To | All records |
How the values work:
SELECT COUNT()returns one number. An Account with no matching Cases returns 0, which passes; it is not treated as “no records.”- At most passes when the count is equal to or less than 3.
{!rhcResult.foundValue}inserts the count, and{!rhcResult.foundValuePluralSuffix}adds “s” when the count is not 1, so the message reads “4 open high-priority cases”.
Step 3: Validate and activate
Section titled “Step 3: Validate and activate”- Run the Validate Record Health Check Configuration Flow action, as described in Validate configuration before activation, and correct every error.
- Activate the Check, then the Check Set.
- Add the Record Health Check component to the Account record page, select Account Related Record Review (Account_Related_Record_Review), and activate the page.
- Assign Record Health Check Card User to the users who test the card.
Step 4: Test the Check
Section titled “Step 4: Test the Check”Select Run on the card for each case.
| Open high-priority Cases the user can see | Result on the card | Found | Expected |
|---|---|---|---|
| 0 | Pass | 0 | at most 3 |
| 3 | Pass | 3 | at most 3 |
| 4 | Warning | 4 | at most 3 |
A user who cannot see one of four Cases sees a count of 3 and Pass, because the Check counts only the Cases that user can see.
What users see
Section titled “What users see”On an Account named Acme with four open high-priority Cases, the row shows Warning, the message
“Acme has 4 open high-priority cases, more than the limit of 3.”, the fix message, a Review Cases
link to the Account’s Cases related list, and Found 4 with Expected at most 3. A passing row
shows Pass; with the default Found/Expected Display, the user selects the arrow next to the
title to see its values.
Optional: publish the result as a Platform Event
Section titled “Optional: publish the result as a Platform Event”To let a Flow or Apex trigger react when a user runs this Check on the card:
- Build and test the subscriber first. See Save individual Check results.
- Edit the Check and select Publish User Result Event.
- To also publish one summary event per run, edit the Check Set and select Publish User Run Event.
The card publishes a Record Health Check Result event for this Check, whatever its result, after a user selects Run or Rerun. Opening the page or refreshing it after a save never publishes.
Resolve problems
Section titled “Resolve problems”| What you see | What to check |
|---|---|
| The count is lower than expected | The user’s access to the Cases, and the exact Priority value in the query. |
| Three Cases fail | Comparison Operator is At most, not Less than. |
| A validation error on Source Query Field | Leave it blank for a bare COUNT() query. |
| Unable to Check | The user can read Cases. |
| No event arrives after Run | Publish User Result Event is selected, and the subscriber is active. |