Skip to content
Suggest a correction

Check that the high-priority Case backlog is within a limit

Example5 min read

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.

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.

  • Install Record Health Check, and assign yourself Record Health Check Admin and the Salesforce Customize Application permission.
  • Confirm that High is 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.

Use the Account Related Record Review Check Set from Check that an Account has at least one Contact, or any active Account Check Set.

Open Setup → Custom Metadata Types, select Manage Records next to Record Health Check, select New, enter these values, and save.

FieldValue
LabelHigh-Priority Case Limit
Check SetAccount Related Record Review
Evaluation TypeVerify with a query
Record Health Check NameHigh_Priority_Case_Limit
Evaluation Order70
ActiveCleared until validation succeeds
Source QuerySELECT COUNT() FROM Case WHERE AccountId = {!record.Id} AND IsClosed = false AND Priority = 'High'
Source Query FieldLeave blank
How To Read Query ResultsOne row or aggregate
Comparison OperatorAt most
Expected Value Comes FromFixed value
Expected Value (Fixed)3
Check TitleHigh-priority Case backlog is within the limit
Check DescriptionPasses when the Account has three or fewer open high-priority Cases.
Message When Failed{!record.Name fallback="This Account"} has {!rhcResult.foundValue} open high-priority case{!rhcResult.foundValuePluralSuffix}, more than the limit of 3.
Fix MessageReview the owner and response plan for each open high-priority Case, and escalate if needed.
Message When Unable To EvaluateUnable to count high-priority Cases. Confirm that you can read Cases.
Failure SeverityWarning
Action LabelReview Cases
Action URL/lightning/r/Account/{!record.Id}/related/Cases/view
Applies ToAll 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”.
  1. Run the Validate Record Health Check Configuration Flow action, as described in Validate configuration before activation, and correct every error.
  2. Activate the Check, then the Check Set.
  3. Add the Record Health Check component to the Account record page, select Account Related Record Review (Account_Related_Record_Review), and activate the page.
  4. Assign Record Health Check Card User to the users who test the card.

Select Run on the card for each case.

Open high-priority Cases the user can seeResult on the cardFoundExpected
0Pass0at most 3
3Pass3at most 3
4Warning4at 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.

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:

  1. Build and test the subscriber first. See Save individual Check results.
  2. Edit the Check and select Publish User Result Event.
  3. 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.

What you seeWhat to check
The count is lower than expectedThe user’s access to the Cases, and the exact Priority value in the query.
Three Cases failComparison Operator is At most, not Less than.
A validation error on Source Query FieldLeave it blank for a bare COUNT() query.
Unable to CheckThe user can read Cases.
No event arrives after RunPublish User Result Event is selected, and the subscriber is active.