Skip to content
Suggest a correction

Check that the Account Owner is on the Account Team

Example4 min read

Create a Record Health Check that reads an Account’s Account Team members and passes when the Account Owner is one of them. The example uses the Verify with a query Evaluation Type in list mode: a formula on the Account supplies the value to find, and a query supplies the list to search.

Account Team members are related records, and the question is whether one value, the owner’s user ID, appears in that list. A query Check with List contains any answers that without code.

  • Install Record Health Check, and assign yourself Record Health Check Admin and the Salesforce Customize Application permission.
  • Confirm that Account Teams are enabled in Setup → Account Teams, and that your process requires the owner to have an explicit Account Team row. Ownership alone already gives the owner access.
  • Confirm that the people who will use the card can see Account Team members.
  • This Check confirms membership only. It does not check the owner’s team role.

You can add the Check to an Account Check Set you already have. To create one, open Setup → Custom Metadata Types, select Manage Records next to Record Health Check Set, select New, enter these values, and save. Leave other fields at their defaults.

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 handoff.
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
LabelOwner Is on Account Team
Check SetAccount Related Record Review
Evaluation TypeVerify with a query
Record Health Check NameOwner_Is_On_Account_Team
Evaluation Order60
ActiveCleared until validation succeeds
Source QueryLeave blank
Source Query FieldLeave blank
How To Read Query ResultsCompare as lists
Value to find in the list (formula)CASESAFEID(OwnerId)
Comparison OperatorList contains any
Comparison QuerySELECT UserId FROM AccountTeamMember WHERE AccountId = {!record.Id}
Comparison Query FieldUserId
If Query Finds No RecordsFail
Check TitleAccount Owner is on the Account Team
Check DescriptionPasses when the Account Owner is one of the Account Team members.
Message When FailedThe owner of {!record.Name fallback="this Account"} is not on the Account Team.
Fix MessageAdd the owner to the Account Team with the role your organization uses.
Failure SeverityWarning
Action LabelReview Account Team
Action URL/lightning/r/Account/{!record.Id}/related/AccountTeamMembers/view
Applies ToAll records
Formula Result TypeText

How the values work:

  • In list mode, Comparison Query supplies the list, and Value to find in the list (formula) supplies the value to look for. Leave Source Query blank.
  • CASESAFEID(OwnerId) returns the owner’s 18-character user ID, the same form the query returns for UserId, so the two can be compared reliably. The comparison ignores capitalization.
  • Formula Result Type set to Text declares that the formula returns text.
  • If Query Finds No Records set to Fail treats an Account with no team members as missing the owner.
  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.

Account Team members the user can seeResult on the card
NoneWarning
Other users, but not the ownerWarning
The Account Owner, with any rolePass

A failed row shows Warning, the message, the fix message, a Review Account Team link, and Found and Expected. Found shows the owner’s user ID, and Expected reads “to be one of” followed by up to ten team members’ user IDs. Because IDs are hard to read, consider setting the Check’s Show Found and Expected to Hide.

What you seeWhat to check
The Account Team related list does not openAccount Teams are enabled, and the related list is on the Account page layout.
Every Account failsSource Query is blank, and Comparison Query Field is UserId.
Unable to CheckThe user can read Account Team members, and the formula is exactly CASESAFEID(OwnerId).