Check that the Account Owner is on the Account Team
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.
Why a query fits
Section titled “Why a query fits”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.
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 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.
Step 1: Create or choose the Check Set
Section titled “Step 1: Create or choose the Check Set”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.
| 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 handoff. |
| 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 | Owner Is on Account Team |
| Check Set | Account Related Record Review |
| Evaluation Type | Verify with a query |
| Record Health Check Name | Owner_ |
| Evaluation Order | 60 |
| Active | Cleared until validation succeeds |
| Source Query | Leave blank |
| Source Query Field | Leave blank |
| How To Read Query Results | Compare as lists |
| Value to find in the list (formula) | CASESAFEID(OwnerId) |
| Comparison Operator | List contains any |
| Comparison Query | SELECT UserId FROM AccountTeamMember WHERE AccountId = {!record. |
| Comparison Query Field | UserId |
| If Query Finds No Records | Fail |
| Check Title | Account Owner is on the Account Team |
| Check Description | Passes when the Account Owner is one of the Account Team members. |
| Message When Failed | The owner of {!record. |
| Fix Message | Add the owner to the Account Team with the role your organization uses. |
| Failure Severity | Warning |
| Action Label | Review Account Team |
| Action URL | /lightning/r/Account/{!record. |
| Applies To | All records |
| Formula Result Type | Text |
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 forUserId, 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.
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.
| Account Team members the user can see | Result on the card |
|---|---|
| None | Warning |
| Other users, but not the owner | Warning |
| The Account Owner, with any role | Pass |
What users see
Section titled “What users see”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.
Resolve problems
Section titled “Resolve problems”| What you see | What to check |
|---|---|
| The Account Team related list does not open | Account Teams are enabled, and the related list is on the Account page layout. |
| Every Account fails | Source Query is blank, and Comparison Query Field is UserId. |
| Unable to Check | The user can read Account Team members, and the formula is exactly CASESAFEID(OwnerId). |