Skip to content
Suggest a correction

Strategic readiness: Apex implementation

Guide18 min read

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.

  • 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.
SkillHow this example teaches it
Build a weighted readiness scoreApex combines several Account signals into one score.
Keep thresholds configurableApex Parameters (JSON) lets an admin tune the decision.
Explain a calculated outcomeThe result shows the score and passing target; the guidance names the four inputs to review.
CriterionPasses when
ContactsAt least one related Contact exists
Open pipelineSum of open Opportunity Amount is greater than zero
Recent activityA closed Task, or an Event, related to the Account is dated within activityDaysBack days
Billing completeBillingStreet, BillingCity, and BillingCountry are all populated
OutcomeWhen 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

This page configures the Check with these values:

SettingValue on this pageMeaning
Points per criterion25, fixed in the classEach of the four criteria adds 25 points when it passes
minScore75The score must be at least this value to pass
activityDaysBack60Look-back for closed Tasks and Events
Missing or invalid JSON80 points / 30 daysValues 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:

GoalConfiguration
One missing area is acceptableminScore of 75
Every area is required, one combined resultminScore of 100
Every area is required, separate visible resultsCreate four Checks instead of using a score

Any value from 76 through 100 requires all four criteria.

Card valueMeets minimumBelow minimumNot Customer - Direct
StatusPASSFAILSKIPPED
FoundNumeric score from 0 through 100Numeric score from 0 through 100Not applicable
ExpectedConfigured minimum scoreConfigured minimum scoreNot applicable
MessageNoneMessage When FailedMessage When Not Applicable
ApproachWhat the user gets
One Verify with ApexOne 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 formulaFour 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 prerequisitesChecks 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.

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.

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.

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.

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.

@IsTest
private 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.

Record Health Check calls the plugin once for a scope:

Map<Id, rhc.RecordHealthCheckOutcome> evaluate(rhc.RecordHealthCheckScope scope)

The context contains:

Scope fieldTypeWhat it contains
recordIdsList<Id>Detached IDs to evaluate, with duplicates removed; use the collection in bulk SOQL
objectApiNameStringAPI name shared by every ID in the scope, such as Account
parametersMap<String, Object>Parsed Apex Parameters (JSON); an empty map when JSON is blank
checkQualifiedApiNameStringQualified Check identity
checkSetQualifiedApiNameStringQualified Check Set identity
checkDeveloperNameStringUnqualified Check DeveloperName
checkSetDeveloperNameStringUnqualified parent Check Set DeveloperName
runIdStringCorrelation 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 fieldWhat the class must return
statusAn outcome created by pass, fail, unableToEvaluate, or skipped
reasonCodeA stable, nonblank code that explains the programmatic reason
foundA typed RecordHealthCheckValue describing what the class observed
comparisonOperatorThe operator behind the decision, such as GREATER_THAN_OR_EQUAL
expectedA 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.

In Setup → Custom Metadata Types → Record Health Check Set → Manage Records, select New and create this Check Set:

Setup fieldValue
LabelAccount Apex Readiness
Record Health Check Set NameAccount_Apex_Readiness
ObjectAccount
Card TitleAccount Readiness
Card SubtitleConfirm the Account meets the strategic readiness score.
When Checks RunWhen the user clicks Run
Summary DisplayShow below checks
Reveal ModeOne by one
Passed ChecksShow each passed check
Skipped ChecksShow each skipped check
Found/Expected DisplayShow on demand
Stop after a system errorUnchecked
Show DiagnosticsUnchecked; enable temporarily only for authorized troubleshooting
Publish User Run EventUnchecked
ActiveChecked

In Setup → Custom Metadata Types → Record Health Check → Manage Records, create the Check:

Setup fieldAPI nameValue
Record Health Check NameDeveloperNameCustomer_Account_Readiness_Score
LabelMasterLabelCustomer Account Readiness Score
Check SetRecord_Health_Check_Set__cAccount_Apex_Readiness
Check TitleCheckTitle__cCustomer Account readiness score meets the minimum
Evaluation TypeEvaluationType__cVerify with Apex
Apex ClassApexClass__cAccountStrategicReadinessCheck
Apex Parameters (JSON)ApexParametersJson__c{"minScore": 75, "activityDaysBack": 60}
Applies ToApplicabilityMode__cWhen a formula is true
Applies When (Formula)ApplicabilityFormula__cISPICKVAL(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.

Setup fieldAPI nameValue
Check DescriptionCheckDescription__cScores Contacts, open pipeline, activity in the last 60 days, and billing address, 25 points each. Passes at 75 or more.
Failure SeverityFailureSeverity__cWarning
Message When FailedFailureMessage__c{!record.Name fallback="This Account"} scored {!rhcResult.foundValue} out of 100, below the minimum of 75.
Message When Unable To EvaluateUnableToEvaluateMessage__cUnable to calculate the readiness score. Confirm that you can read the Account's related records.
Message When Not ApplicableApplicabilityNotMetMessage__c{!record.Name fallback="This Account"} is not a direct customer, so it is not scored.
Prerequisite CheckPrerequisiteCheck__cLeave blank
Fix MessageFixMessage__cCheck which signals are missing: Contacts, open pipeline Amount, activity in the last 60 days, and a complete billing address.
Action LabelActionLabel__cLeave blank: one portable link cannot correct all four readiness areas.
Action URLActionUrl__cLeave blank; use an org-specific readiness report or playbook only after verifying it.
Evaluation OrderEvaluationOrder__c30
ActiveIsActive__cCleared until validation succeeds, then checked
Publish User Result EventPublishUserResultEvent__cUnchecked

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.

The Apex class turns the weighted score and configured threshold into these user-facing values:

Health result or card valueWhat the user sees
PASSAn Account scoring at or above minScore passes.
FAILA score below minScore shows Warning, the label for Warning severity.
SKIPPEDAnother Account Type is skipped by the applicability formula before the class runs.
FoundFound shows the calculated score, such as 75.
ExpectedExpected 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.

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_MODE so 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 ERROR with reason code PLUGIN_THREW, shown as System Error. If the Account is deleted or is no longer visible after the run starts, the class returns UNABLE_TO_EVALUATE with RECORD_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.

  1. 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 Expected 75.
  2. Add only Contacts (score 25). Confirm the row still shows Warning.
  3. Meet three of the four criteria (score 75) and confirm Pass.
  4. Change Type to another value and confirm Skipped; the class does not run.
  5. Repeat with restricted related-record access and confirm the score reflects only visible evidence.

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.

  1. Add Record Health Check to the Account record page in Lightning App Builder.
  2. Select Account_Apex_Readiness, save, and activate the page.
  3. Open an Account, click Run or Rerun, and compare the result with Execute Anonymous.
SymptomWhat to verify
Check always skipsConfirm the Type value is exactly Customer - Direct, or adapt the applicability formula.
Score is unexpectedly lowCheck all four criteria, blank Amount, activity window, and running-user visibility.
PLUGIN_THREWVerify 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.