Strategic readiness: Apex implementation
Build a custom Apex class for Record Health Check that scores an Account from 0 to 100 on four signals, Contacts, open pipeline, recent activity, and a complete billing address, and passes when the score meets a minimum set in Custom Metadata. This page gives the complete class, its contract, and its tests. For the Setup values only, see Score a customer Account’s readiness.
This Apex class does not install with the package. Create and deploy it, with its test class, in
Step 2 before configuring the Check. The code on this page uses the public rhc.* types provided
by the installed package.
Before you start
Section titled “Before you start”- Install Record Health Check.
- Assign Record Health Check Admin to the administrator creating the Check Set and Check.
- Have a Salesforce developer review, test, and deploy the Apex class. Record Health Check does not install this example class.
- Decide which Accounts are scored. This page scores Accounts whose Type is Customer - Direct, a standard picklist value. Change the applicability formula in Step 4 to match how your org identifies the Accounts to score.
What you will learn
Section titled “What you will learn”| Skill | How this example teaches it |
|---|---|
| Build a weighted readiness score | Apex combines several Account signals into one score. |
| Keep thresholds configurable | Apex Parameters (JSON) lets an admin tune the decision. |
| Explain a calculated outcome | The result shows the score and passing target; the guidance names the four inputs to review. |
Readiness criteria
Section titled “Readiness criteria”What contributes to readiness
Section titled “What contributes to readiness”| Criterion | Passes when |
|---|---|
| Contacts | At least one related Contact exists |
| Open pipeline | Sum of open Opportunity Amount is greater than zero |
| Recent activity | A closed Task, or an Event, related to the Account is dated within activityDaysBack days |
| Billing complete | BillingStreet, BillingCity, and BillingCountry are all populated |
How the result is decided
Section titled “How the result is decided”| Outcome | When it happens |
|---|---|
Pass (PASS) | The score meets or exceeds minScore |
Fail (FAIL) | The score is below minScore |
Skipped (SKIPPED) | Account Type is not Customer - Direct, so the scoring class does not run |
Choose how your org measures readiness
Section titled “Choose how your org measures readiness”This page configures the Check with these values:
| Setting | Value on this page | Meaning |
|---|---|---|
| Points per criterion | 25, fixed in the class | Each of the four criteria adds 25 points when it passes |
minScore | 75 | The score must be at least this value to pass |
activityDaysBack | 60 | Look-back for closed Tasks and Events |
| Missing or invalid JSON | 80 points / 30 days | Values the class uses when a parameter is missing, not a number, or out of range |
The possible scores are 0, 25, 50, 75, and 100. Choose minScore to match your process:
| Goal | Configuration |
|---|---|
| One missing area is acceptable | minScore of 75 |
| Every area is required, one combined result | minScore of 100 |
| Every area is required, separate visible results | Create four Checks instead of using a score |
Any value from 76 through 100 requires all four criteria.
What the card shows
Section titled “What the card shows”| Card value | Meets minimum | Below minimum | Not Customer - Direct |
|---|---|---|---|
| Status | PASS | FAIL | SKIPPED |
| Found | Numeric score from 0 through 100 | Numeric score from 0 through 100 | Not applicable |
| Expected | Configured minimum score | Configured minimum score | Not applicable |
| Message | None | Message When Failed | Message When Not Applicable |
Why use Verify with Apex
Section titled “Why use Verify with Apex”| Approach | What the user gets |
|---|---|
| One Verify with Apex | One readiness result with a score out of 100 and a configurable passing score. The failure and fix guidance names the four source areas to review. |
| Four separate Query or Checks that use Verify with a formula | Four pass-or-fail results, one for Contacts, pipeline, activity, and billing. Use this approach when every area is required or should remain visible on its own. |
| Checks with prerequisites | Checks can run in a required order, but their results are not added into one score. Use prerequisites when a later check should wait for an earlier check to pass. |
What Record Health Check passes to Apex
Section titled “What Record Health Check passes to Apex”Shared scope inputs are documented once in the
Apex examples README. This Check receives Account
IDs plus two scoring parameters, minScore and activityDaysBack; the 25 points per criterion are
fixed in the class.
List<Id> accountIds = scope.recordIds;The complete class below queries Accounts, Contacts, Opportunities, Tasks, and Events once per scope and then assembles one score for every requested Account.
Confirm the score and developer ownership
Section titled “Confirm the score and developer ownership”This class is not installed with the package. A developer must review, test, and deploy it before configuration. If no developer owns it, four focused Formula or Query Checks are clearer and show which criterion failed.
Build tests at scores of 50, 75, and 100 so the boundary is visible. The class falls back to its defaults for missing or invalid JSON instead of reporting a configuration error, so a typing mistake in the JSON silently changes the minimum to 80. The card shows the total score, not which criteria were missed.
ISPICKVAL(Type, "Customer - Direct") uses the stored Account Type picklist value, not Record
Type. Confirm it in Object Manager. Review user-mode access across Account, Contact, Opportunity, and
activity fields. Add the card to the Account Lightning page, activate the intended assignment, and
test as a user with Record Health Check Card User. The Apex tests and Execute Anonymous are
developer steps.
Step 1: Choose the score and activity window
Section titled “Step 1: Choose the score and activity window”Use Check parameters to change the passing score and activity window without editing the class:
{ "minScore": 75, "activityDaysBack": 60}Record Health Check parses the JSON and supplies both named values in scope.parameters.
minScore accepts 1–100, and activityDaysBack accepts 1–3650; missing or invalid values
silently use 80 and 30. Enter and test explicit valid whole numbers rather than relying on those
fallbacks. See
Parameter parsing patterns
for validation and type-conversion guidance.
Implementation summary
Section titled “Implementation summary”The class queries the
three Account billing fields, counts visible Contacts, sums visible open Opportunity Amount, and
counts visible completed Tasks plus Events inside the window. Each true criterion adds 25 points.
It returns PASS when score >= minScore. Found shows the numeric score, and Expected shows the
configured minimum. The Check’s guidance directs the user to Contacts, open pipeline, recent
activity, and billing address when the score is low.
Applicability evaluates ISPICKVAL(Type, "Customer - Direct") before Apex runs. An open Opportunity with
blank Amount earns no pipeline points; any missing billing component loses all billing points; one
Contact or one qualifying activity is sufficient for its respective criterion.
Step 2: Create and test the Apex class
Section titled “Step 2: Create and test the Apex class”Create an Apex class named AccountStrategicReadinessCheck from the code below. Comments explain
the inputs, administrator settings, user access, pass logic, and returned values.
/** * @author Gautam Kolan (https://github.com/gkolan) * SPDX-License-Identifier: Apache-2.0 */
/** * Reference RecordHealthCheckPlugin — weighted readiness score for Strategic Accounts. * Example implementation retained here only as an integration-test fixture. * {"minScore": 80, "activityDaysBack": 60} */global with sharing class AccountStrategicReadinessCheck implements rhc.RecordHealthCheckPlugin { private static final Integer DEFAULT_MIN_SCORE = 80; private static final Integer DEFAULT_ACTIVITY_DAYS = 30; private static final Integer MIN_SCORE = 1; private static final Integer MAX_SCORE = 100; private static final Integer MIN_ACTIVITY_DAYS = 1; private static final Integer MAX_ACTIVITY_DAYS = 3650; private static final Integer POINTS_PER_CRITERION = 25;
global Map<Id, rhc.RecordHealthCheckOutcome> evaluate( rhc.RecordHealthCheckScope scope ) { if (scope == null || scope.recordIds == null || scope.recordIds.isEmpty()) { return new Map<Id, rhc.RecordHealthCheckOutcome>(); } Set<Id> recordIds = new Set<Id>(scope.recordIds); Integer minScore = resolveInt( scope.parameters, 'minScore', DEFAULT_MIN_SCORE, MIN_SCORE, MAX_SCORE ); Integer activityDays = resolveInt( scope.parameters, 'activityDaysBack', DEFAULT_ACTIVITY_DAYS, MIN_ACTIVITY_DAYS, MAX_ACTIVITY_DAYS );
// Five queries for the whole scope, where the single-record version needed // five per record. Each returns the SET of Accounts meeting one criterion, // so an Account absent from a set simply scores nothing for it. Map<Id, Account> accounts = loadAccounts(recordIds); Set<Id> withContacts = accountsWithContacts(recordIds); Set<Id> withPipeline = accountsWithOpenPipeline(recordIds); Set<Id> withActivity = accountsWithRecentActivity(recordIds, activityDays);
rhc.RecordHealthCheckValue expected = rhc.RecordHealthCheckValue.ofCount(minScore); Map<Id, rhc.RecordHealthCheckOutcome> results = new Map<Id, rhc.RecordHealthCheckOutcome>(); for (Id recordId : recordIds) { Account acct = accounts.get(recordId); if (acct == null) { // Deleted between selection and execution, or invisible to this user. // Never FAIL: failing a record the user cannot see would leak that it // exists. results.put( recordId, rhc.RecordHealthCheckOutcome.unableToEvaluate( 'RECORD_NO_LONGER_AVAILABLE' ) ); continue; }
Integer score = 0; if (withContacts.contains(recordId)) { score += POINTS_PER_CRITERION; } if (withPipeline.contains(recordId)) { score += POINTS_PER_CRITERION; } if (withActivity.contains(recordId)) { score += POINTS_PER_CRITERION; } if (billingComplete(acct)) { score += POINTS_PER_CRITERION; }
results.put( recordId, (score >= minScore ? rhc.RecordHealthCheckOutcome.pass('APEX_PASS') : rhc.RecordHealthCheckOutcome.fail('APEX_FAIL')) .withFound(rhc.RecordHealthCheckValue.ofCount(score)) .withComparison('GREATER_THAN_OR_EQUAL', expected) ); } return results; }
private static Map<Id, Account> loadAccounts(Set<Id> recordIds) { return new Map<Id, Account>( [ SELECT Id, BillingStreet, BillingCity, BillingCountry FROM Account WHERE Id IN :recordIds WITH USER_MODE ] ); }
private static Set<Id> accountsWithContacts(Set<Id> recordIds) { Set<Id> found = new Set<Id>(); for (AggregateResult row : [ SELECT AccountId accountId FROM Contact WHERE AccountId IN :recordIds WITH USER_MODE GROUP BY AccountId ]) { found.add((Id) row.get('accountId')); } return found; }
private static Set<Id> accountsWithOpenPipeline(Set<Id> recordIds) { Set<Id> found = new Set<Id>(); for (AggregateResult row : [ SELECT AccountId accountId, SUM(Amount) total FROM Opportunity WHERE AccountId IN :recordIds AND IsClosed = FALSE WITH USER_MODE GROUP BY AccountId ]) { Decimal total = (Decimal) row.get('total'); if (total != null && total > 0) { found.add((Id) row.get('accountId')); } } return found; }
private static Set<Id> accountsWithRecentActivity( Set<Id> recordIds, Integer daysBack ) { Date cutoff = Date.today().addDays(-daysBack); if (cutoff == null) { return new Set<Id>(); } Set<Id> found = new Set<Id>(); for (AggregateResult row : [ SELECT WhatId whatId FROM Task WHERE WhatId IN :recordIds AND IsClosed = TRUE AND ActivityDate >= :cutoff WITH USER_MODE GROUP BY WhatId ]) { found.add((Id) row.get('whatId')); } for (AggregateResult row : [ SELECT WhatId whatId FROM Event WHERE WhatId IN :recordIds AND ActivityDate >= :cutoff WITH USER_MODE GROUP BY WhatId ]) { found.add((Id) row.get('whatId')); } return found; }
private static Boolean billingComplete(Account acct) { return String.isNotBlank(acct.BillingStreet) && String.isNotBlank(acct.BillingCity) && String.isNotBlank(acct.BillingCountry); }
@TestVisible private static Integer resolveInt( Map<String, Object> parameters, String key, Integer defaultValue, Integer min, Integer max ) { if (parameters == null) { return defaultValue; } Object raw = parameters.get(key); if (raw == null) { return defaultValue; } try { Integer parsed = Integer.valueOf(String.valueOf(raw)); return parsed >= min && parsed <= max ? parsed : defaultValue; } catch (Exception ex) { return defaultValue; } }}Create the test class AccountStrategicReadinessCheckTest. Salesforce requires Apex test coverage
to deploy the class to production. The tests call the class directly, as Record Health Check does,
so they need no Check Set or Check. They cover a score of 0, each 25-point criterion, a score of
100, both parameter fallbacks, a deleted Account, and 200 Accounts in five SOQL queries.
The Task status Completed must be a closed Task status in the org, and the billing country must
be valid when State and Country/Territory Picklists are enabled. If the org has validation rules or
required fields on these objects, add those values to the test records.
@IsTestprivate class AccountStrategicReadinessCheckTest { private static final Map<String, Object> PAGE_PARAMETERS = new Map<String, Object>{ 'minScore' => 75, 'activityDaysBack' => 60 };
// Runs the class for one Account, as Record Health Check does. private static rhc.RecordHealthCheckOutcome evaluateOne( Id accountId, Map<String, Object> parameters ) { return new AccountStrategicReadinessCheck() .evaluate( new rhc.RecordHealthCheckScope( 'Account', new List<Id>{ accountId }, parameters, 'Customer_Account_Readiness_Score', 'Account_Apex_Readiness', null ) ) .get(accountId); }
private static Account billedAccount(String name) { return new Account( Name = name, BillingStreet = '1 Main Street', BillingCity = 'Springfield', BillingCountry = 'United States' ); }
private static Contact contactFor(Id accountId) { return new Contact(LastName = 'Buyer', AccountId = accountId); }
private static Opportunity openPipelineFor(Id accountId) { return new Opportunity( AccountId = accountId, Name = 'Open deal', StageName = 'Prospecting', CloseDate = Date.today().addDays(30), Amount = 1000 ); }
private static Task completedTaskFor(Id accountId, Date activityDate) { return new Task( WhatId = accountId, Subject = 'Call', Status = 'Completed', ActivityDate = activityDate ); }
@IsTest static void emptyAccountScoresZeroAndFails() { Account accountRecord = new Account(Name = 'Empty'); insert accountRecord;
rhc.RecordHealthCheckOutcome outcome = evaluateOne( accountRecord.Id, PAGE_PARAMETERS );
Assert.areEqual(rhc.RecordHealthCheckStatus.FAIL, outcome.status); Assert.areEqual('0', outcome.found.storedValue); Assert.areEqual('75', outcome.expected.storedValue); }
@IsTest static void eachCriterionAddsTwentyFivePoints() { List<Account> accounts = new List<Account>{ new Account(Name = 'Contact only'), new Account(Name = 'Pipeline only'), new Account(Name = 'Activity only'), billedAccount('Billing only') }; insert accounts; insert contactFor(accounts[0].Id); insert openPipelineFor(accounts[1].Id); insert completedTaskFor(accounts[2].Id, Date.today());
for (Account accountRecord : accounts) { Assert.areEqual( '25', evaluateOne(accountRecord.Id, PAGE_PARAMETERS).found.storedValue, accountRecord.Name ); } }
@IsTest static void allCriteriaScoreOneHundredAndPass() { Account accountRecord = billedAccount('Ready'); insert accountRecord; insert contactFor(accountRecord.Id); insert openPipelineFor(accountRecord.Id); insert completedTaskFor(accountRecord.Id, Date.today());
rhc.RecordHealthCheckOutcome outcome = evaluateOne( accountRecord.Id, PAGE_PARAMETERS );
Assert.areEqual(rhc.RecordHealthCheckStatus.PASS, outcome.status); Assert.areEqual('100', outcome.found.storedValue); }
@IsTest static void invalidMinScoreUsesEighty() { Account accountRecord = new Account(Name = 'Default minimum'); insert accountRecord;
for ( Map<String, Object> parameters : new List<Map<String, Object>>{ new Map<String, Object>(), new Map<String, Object>{ 'minScore' => 'high' }, new Map<String, Object>{ 'minScore' => 101 } } ) { Assert.areEqual( '80', evaluateOne(accountRecord.Id, parameters).expected.storedValue ); } }
@IsTest static void invalidActivityWindowUsesThirtyDays() { Account accountRecord = new Account(Name = 'Older activity'); insert accountRecord; insert completedTaskFor(accountRecord.Id, Date.today().addDays(-45));
// Inside a 60-day window, outside the 30-day fallback. Assert.areEqual( '25', evaluateOne(accountRecord.Id, PAGE_PARAMETERS).found.storedValue ); Assert.areEqual( '0', evaluateOne( accountRecord.Id, new Map<String, Object>{ 'activityDaysBack' => 'sixty' } ) .found.storedValue ); }
@IsTest static void deletedAccountIsUnableToEvaluate() { Account accountRecord = new Account(Name = 'Deleted'); insert accountRecord; delete accountRecord;
rhc.RecordHealthCheckOutcome outcome = evaluateOne( accountRecord.Id, PAGE_PARAMETERS );
Assert.areEqual( rhc.RecordHealthCheckStatus.UNABLE_TO_EVALUATE, outcome.status ); Assert.areEqual('RECORD_NO_LONGER_AVAILABLE', outcome.reasonCode); }
@IsTest static void twoHundredAccountsUseFiveQueries() { List<Account> accounts = new List<Account>(); for (Integer i = 0; i < 200; i++) { accounts.add(new Account(Name = 'Bulk ' + i)); } insert accounts; rhc.RecordHealthCheckScope scope = new rhc.RecordHealthCheckScope( 'Account', new List<Id>(new Map<Id, Account>(accounts).keySet()), PAGE_PARAMETERS, 'Customer_Account_Readiness_Score', 'Account_Apex_Readiness', null );
Test.startTest(); Map<Id, rhc.RecordHealthCheckOutcome> outcomes = new AccountStrategicReadinessCheck() .evaluate(scope); Integer queriesUsed = Limits.getQueries(); Test.stopTest();
Assert.areEqual(200, outcomes.size()); Assert.areEqual(5, queriesUsed); }}Run the tests in Developer Console → Test → New Run, or with
sf apex run test --class-names AccountStrategicReadinessCheckTest. All seven must pass before you
deploy both classes.
Context and result contract
Section titled “Context and result contract”Record Health Check calls the plugin once for a scope:
Map<Id, rhc.RecordHealthCheckOutcome> evaluate(rhc.RecordHealthCheckScope scope)The context contains:
| Scope field | Type | What it contains |
|---|---|---|
recordIds | List<Id> | Detached IDs to evaluate, with duplicates removed; use the collection in bulk SOQL |
objectApiName | String | API name shared by every ID in the scope, such as Account |
parameters | Map<String, Object> | Parsed Apex Parameters (JSON); an empty map when JSON is blank |
checkQualifiedApiName | String | Qualified Check identity |
checkSetQualifiedApiName | String | Qualified Check Set identity |
checkDeveloperName | String | Unqualified Check DeveloperName |
checkSetDeveloperName | String | Unqualified parent Check Set DeveloperName |
runId | String | Correlation identifier for the evaluation run |
The returned map must contain exactly one entry for every requested ID. Build each outcome with a status factory and typed values:
| Outcome field | What the class must return |
|---|---|
status | An outcome created by pass, fail, unableToEvaluate, or skipped |
reasonCode | A stable, nonblank code that explains the programmatic reason |
found | A typed RecordHealthCheckValue describing what the class observed |
comparisonOperator | The operator behind the decision, such as GREATER_ |
expected | A typed RecordHealthCheckValue describing the passing requirement |
For applicability, configure Applies To on the Check so Record Health Check skips before Apex
runs. The framework supplies identity, label, severity, messages, display values, and diagnostics.
A missing outcome, an extra map key, an invalid status, missing Found or Expected values on PASS
or FAIL, or an unhandled exception never becomes a pass: the record shows System Error, and the
reason code names the problem. A prohibited side effect, such as DML, stops the whole request. See
Returning an outcome.
Step 3: Create the Check Set
Section titled “Step 3: Create the Check Set”In Setup → Custom Metadata Types → Record Health Check Set → Manage Records, select New and create this Check Set:
| Setup field | Value |
|---|---|
| Label | Account Apex Readiness |
| Record Health Check Set Name | Account_ |
| Object | Account |
| Card Title | Account Readiness |
| Card Subtitle | Confirm the Account meets the strategic readiness score. |
| When Checks Run | When the user clicks Run |
| Summary Display | Show below checks |
| Reveal Mode | One by one |
| Passed Checks | Show each passed check |
| Skipped Checks | Show each skipped check |
| Found/Expected Display | Show on demand |
| Stop after a system error | Unchecked |
| Show Diagnostics | Unchecked; enable temporarily only for authorized troubleshooting |
| Publish User Run Event | Unchecked |
| Active | Checked |
Step 4: Configure the Check
Section titled “Step 4: Configure the Check”In Setup → Custom Metadata Types → Record Health Check → Manage Records, create the Check:
| Setup field | API name | Value |
|---|---|---|
| Record Health Check Name | DeveloperName | Customer_ |
| Label | MasterLabel | Customer Account Readiness Score |
| Check Set | Record_ | Account_ |
| Check Title | CheckTitle_ | Customer Account readiness score meets the minimum |
| Evaluation Type | EvaluationType_ | Verify with Apex |
| Apex Class | ApexClass_ | AccountStrategicReadinessCheck |
| Apex Parameters (JSON) | ApexParametersJson_ | {"minScore": 75, "activityDaysBack": 60} |
| Applies To | ApplicabilityMode_ | When a formula is true |
| Applies When (Formula) | ApplicabilityFormula_ | ISPICKVAL(Type, "Customer - Direct") |
Confirm the Customer - Direct Type picklist value in your org. Skip comes from applicability: the class always returns PASS or FAIL when it runs.
Optional configuration
Section titled “Optional configuration”| Setup field | API name | Value |
|---|---|---|
| Check Description | CheckDescription_ | Scores Contacts, open pipeline, activity in the last 60 days, and billing address, 25 points each. Passes at 75 or more. |
| Failure Severity | FailureSeverity_ | Warning |
| Message When Failed | FailureMessage_ | {!record. |
| Message When Unable To Evaluate | UnableToEvaluateMessage_ | Unable to calculate the readiness score. |
| Message When Not Applicable | ApplicabilityNotMetMessage_ | {!record. |
| Prerequisite Check | PrerequisiteCheck_ | Leave blank |
| Fix Message | FixMessage_ | Check which signals are missing: Contacts, open pipeline Amount, activity in the last 60 days, and a complete billing address. |
| Action Label | ActionLabel_ | Leave blank: one portable link cannot correct all four readiness areas. |
| Action URL | ActionUrl_ | Leave blank; use an org-specific readiness report or playbook only after verifying it. |
| Evaluation Order | EvaluationOrder_ | 30 |
| Active | IsActive_ | Cleared until validation succeeds, then checked |
| Publish User Result Event | PublishUserResultEvent_ | Unchecked |
minScore and activityDaysBack change the passing score and activity window without changing the class.
The applicability fields in Configure the Check are required for the documented SKIPPED
result. Add an action link only when it helps the user identify the missing readiness area; an
Account view link alone does not explain which criterion lost points.
What the user sees
Section titled “What the user sees”The Apex class turns the weighted score and configured threshold into these user-facing values:
| Health result or card value | What the user sees |
|---|---|
PASS | An Account scoring at or above minScore passes. |
FAIL | A score below minScore shows Warning, the label for Warning severity. |
SKIPPED | Another Account Type is skipped by the applicability formula before the class runs. |
| Found | Found shows the calculated score, such as 75. |
| Expected | Expected shows the minimum, such as 75, without the at least wording a Query Check adds. |
Scores move in 25-point increments, so a minimum of 75 passes an Account that meets any three of the four criteria.
Security and access
Section titled “Security and access”The readiness score follows the running user’s Salesforce access.
-
Account billing fields plus visible Contacts, open Opportunities, Tasks, and Events.
-
A user who cannot see a qualifying related record may receive a lower score than an administrator for the same Account.
-
A lower user-mode score is not proof that the related record does not exist. Keep
WITH USER_MODEso scores reflect the running user’s access. -
If a query throws because the running user cannot access an object or queried field, Record Health Check returns
ERRORwith reason codePLUGIN_THREW, shown as System Error. If the Account is deleted or is no longer visible after the run starts, the class returnsUNABLE_TO_EVALUATEwithRECORD_NO_LONGER_AVAILABLE. -
The class reads data only and performs no DML or callouts.
-
Compare the score for the intended user and an administrator, then confirm the difference matches the approved sharing model.
Step 5: Test the Check
Section titled “Step 5: Test the Check”- Set Type to Customer - Direct on an Account with no Contacts, no open pipeline Amount, no recent activity, and incomplete billing (score 0). Confirm Warning, Found
0, and Expected75. - Add only Contacts (score 25). Confirm the row still shows Warning.
- Meet three of the four criteria (score 75) and confirm Pass.
- Change Type to another value and confirm Skipped; the class does not run.
- Repeat with restricted related-record access and confirm the score reflects only visible evidence.
Execute Anonymous
Section titled “Execute Anonymous”Run this from Developer Console → Debug → Open Execute Anonymous Window after replacing the placeholder with an Account ID you can access:
Id accountId = '001XXXXXXXXXXXXXXX';rhc.RecordHealthCheckResponse response = rhc.RecordHealthCheck.evaluate( // This is the Check Qualified API Name created in Step 4. rhc.RecordHealthCheckRequest.forCheck('Customer_Account_Readiness_Score', accountId) .withResultMode(rhc.RecordHealthCheckResultMode.EVALUATION_WITH_DISPLAY));System.debug(LoggingLevel.INFO, JSON.serializePretty(response));Confirm evaluation.status, display.foundDisplayValue, and
display.expectedDisplayValue match the same Account on the card.
Lightning record page
Section titled “Lightning record page”- Add Record Health Check to the Account record page in Lightning App Builder.
- Select
Account_Apex_Readiness, save, and activate the page. - Open an Account, click Run or Rerun, and compare the result with Execute Anonymous.
Resolve problems and customize the Check
Section titled “Resolve problems and customize the Check”| Symptom | What to verify |
|---|---|
| Check always skips | Confirm the Type value is exactly Customer - Direct, or adapt the applicability formula. |
| Score is unexpectedly low | Check all four criteria, blank Amount, activity window, and running-user visibility. |
PLUGIN_ | Verify object and field access, and inspect authorized diagnostics. |
Use JSON to change the minimum or window. Changing criteria or weights requires matching class, test, threshold, and documentation updates.