Check that every open Opportunity has a Next Step
Create a Record Health Check on an Account that reviews each open Opportunity and passes only when every one has a Next Step. Accounts with no open Opportunities show Skipped. The example uses the Verify with a query Evaluation Type with the Every record passes setting.
Why a query fits
Section titled “Why a query fits”The Next Step values are on related Opportunity records, so one SOQL query returns them, and Every record passes tests each returned row. Use a Check rather than a Validation Rule so that a missing Next Step shows up during an Account review without forcing a value on every Opportunity save.
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.
- Decide whether every open stage needs a Next Step. To exempt early stages, add a stage filter to
the query, such as
AND StageName != 'Prospecting'. - Confirm that the people who will use the card can read Opportunities and the Next Step field.
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. To create it, open Setup → Custom Metadata Types, select Manage Records next to Record Health Check Set, select New, enter these values, and save.
| Field | Value |
|---|---|
| Label | Account Related Record Review |
| Object | Account |
| Record Health Check Set Name | Account_ |
| Active | Cleared until validation succeeds |
| Card Title | Account Related Record Review |
| Card Subtitle | Confirm related records are ready for pipeline review. |
| When Checks Run | When the user clicks Run |
| Found/Expected Display | Show on demand |
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 | Open Opportunities Have Next Steps |
| Check Set | Account Related Record Review |
| Evaluation Type | Verify with a query |
| Record Health Check Name | Open_ |
| Evaluation Order | 20 |
| Active | Cleared until validation succeeds |
| Source Query | SELECT NextStep FROM Opportunity WHERE AccountId = {!record. |
| Source Query Field | NextStep |
| How To Read Query Results | Every record passes |
| Comparison Operator | Is not empty |
| If Query Finds No Records | Skip |
| If Field Value Is Empty | Treat as not matching |
| Check Title | Every open Opportunity has a Next Step |
| Check Description | Passes when each open Opportunity on the Account has a Next Step. |
| Message When Failed | One or more open Opportunities on {!record. |
| Fix Message | Enter a Next Step on each open Opportunity that is missing one, then run the Check again. |
| Message When Unable To Evaluate | Unable to check Next Step on open Opportunities. |
| Failure Severity | Warning |
| Action Label | Review open Opportunities |
| Action URL | /lightning/r/Account/{!record. |
| Applies To | All records |
| Max Query Rows (1-2000) | 200 |
How the values work:
- Every record passes tests the Next Step of each returned Opportunity with Is not empty. One blank value fails the Check.
- If Field Value Is Empty set to Treat as not matching makes a blank Next Step fail instead of being ignored.
- If Query Finds No Records set to Skip shows Skipped when the Account has no open Opportunities, because there is nothing to review.
- The card’s Found value already counts the failing Opportunities, such as “1 of 2 Opportunities
did not pass”, so the message does not repeat the count.
{!rhcResult.failedRecordCount}and{!rhcResult.totalRecordCount}are blank in Message When Failed; to word the count yourself, put them in Display: Found Text.
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 Opportunities the user can see | Next Step values | Result on the card | Found |
|---|---|---|---|
| 0 | Not applicable | Skipped | None |
| 1 | Populated | Pass | 0 of 1 Opportunities did not pass |
| 2 | Both populated | Pass | 0 of 2 Opportunities did not pass |
| 2 | One blank | Warning | 1 of 2 Opportunities did not pass |
The Found text comes from the object’s plural label, so it reads “Opportunities” in an English org. Expected reads “to not be blank”.
What users see
Section titled “What users see”A failed row shows Warning, the message “One or more open Opportunities on Acme have no Next Step.”, the fix message, a Review open Opportunities link, and Found and Expected. On an Account with no open Opportunities, the row shows Skipped.
The Check reviews only the Opportunities the running user can see. A user who cannot see an Opportunity with a blank Next Step can see Pass where another user sees Warning.
Resolve problems
Section titled “Resolve problems”| What you see | What to check |
|---|---|
| Closed Opportunities are counted | Source Query includes AND IsClosed = false. |
| A blank Next Step passes | How To Read Query Results is Every record passes, and If Field Value Is Empty is Treat as not matching. |
| An Account shows Skipped unexpectedly | The user can see the Account’s open Opportunities. |
| Unable to Check | The user can read Opportunities and Next Step. |