Skip to content
Suggest a correction

Check that every open Opportunity has a Next Step

Example5 min read

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.

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.

  • 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.

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.

FieldValue
LabelAccount Related Record Review
ObjectAccount
Record Health Check Set NameAccount_Related_Record_Review
ActiveCleared until validation succeeds
Card TitleAccount Related Record Review
Card SubtitleConfirm related records are ready for pipeline review.
When Checks RunWhen the user clicks Run
Found/Expected DisplayShow on demand

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

FieldValue
LabelOpen Opportunities Have Next Steps
Check SetAccount Related Record Review
Evaluation TypeVerify with a query
Record Health Check NameOpen_Opportunities_Have_Next_Steps
Evaluation Order20
ActiveCleared until validation succeeds
Source QuerySELECT NextStep FROM Opportunity WHERE AccountId = {!record.Id} AND IsClosed = false
Source Query FieldNextStep
How To Read Query ResultsEvery record passes
Comparison OperatorIs not empty
If Query Finds No RecordsSkip
If Field Value Is EmptyTreat as not matching
Check TitleEvery open Opportunity has a Next Step
Check DescriptionPasses when each open Opportunity on the Account has a Next Step.
Message When FailedOne or more open Opportunities on {!record.Name fallback="this Account"} have no Next Step.
Fix MessageEnter a Next Step on each open Opportunity that is missing one, then run the Check again.
Message When Unable To EvaluateUnable to check Next Step on open Opportunities. Confirm that you can read Opportunities and Next Step.
Failure SeverityWarning
Action LabelReview open Opportunities
Action URL/lightning/r/Account/{!record.Id}/related/Opportunities/view
Applies ToAll 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.
  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 Opportunities the user can seeNext Step valuesResult on the cardFound
0Not applicableSkippedNone
1PopulatedPass0 of 1 Opportunities did not pass
2Both populatedPass0 of 2 Opportunities did not pass
2One blankWarning1 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”.

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.

What you seeWhat to check
Closed Opportunities are countedSource Query includes AND IsClosed = false.
A blank Next Step passesHow To Read Query Results is Every record passes, and If Field Value Is Empty is Treat as not matching.
An Account shows Skipped unexpectedlyThe user can see the Account’s open Opportunities.
Unable to CheckThe user can read Opportunities and Next Step.