Skip to content

Check whether an Account has recent activity

Configure the packaged Apex Check that counts completed Tasks and past Events related to an Account. This example requires two activities in the last 90 days.

The packaged Apex plugin handles Task and Event rules that would be awkward to maintain as one record formula or query configuration.

  • Agree on the activity window and minimum count. daysBack accepts 1–3,650 and minimumActivities accepts 1–1,000.
  • Confirm intended users can read the Account and qualifying activities.
  • Use the packaged AccountHasRecentActivityCheck; no custom Apex is required.
  • Save the Check Set and Check inactive until validation succeeds.

Create an Account Check Set named Account Apex Readiness. Set it to run on click and leave Active unchecked.

Then create this Check:

Salesforce fieldValue
LabelHas Recent Activity
Record Health Check NameAccount_Has_Recent_Activity
Check SetAccount Apex Readiness
Check TitleHas recent activity
Evaluation TypeVerify with Apex
Apex ClassAccountHasRecentActivityCheck
Apex Parameters (JSON){"daysBack": 90, "minimumActivities": 2}
Failure SeverityWarning
Message When Failed{!record.Name fallback="This Account"} needs two completed activities in the last 90 days.
Fix MessageReview the timeline and log only activity that actually occurred.
Action LabelLog account activity
Action URL/lightning/o/Task/new?defaultFieldValues=WhatId={!record.Id}
Evaluation Order10
ActiveUnchecked until validation succeeds
  1. Run the configuration-validation Flow.
  2. Activate the Check and Check Set only after validation succeeds.
  3. Assign Record Health Check Card User.

Test zero, one, and two qualifying activities. Repeat as a restricted user; hidden activities cannot contribute to the count. Enter invalid JSON in a sandbox and confirm Unable to Check, then restore valid parameters.

The Apex class returns the outcome and display values after applicability and prerequisite checks.

Result detailMeaning
PASSThe class reports that the configured business rule is satisfied.
FAILThe class reports a normal business-rule failure, and the card shows the configured guidance.
SKIPPEDThe Check does not apply or a prerequisite prevents the Apex class from running.
FoundThe class-provided value that explains the observed record state.
ExpectedThe class-provided target or comparison value.
What you seeCheck this first
Apex class is not foundConfirm the package version and copy the class name exactly
Invalid Apex parametersUse JSON integers and only daysBack and minimumActivities
Count is lower than expectedConfirm activity dates, completion status, relationship, and running-user access
Log activity does not open correctlyVerify the action URL in your org before activation

See Recent activity Apex implementation for the plugin contract, packaged source, tests, parameter validation, and customization guidance.