Asynchronous Apex
Run Record Health Check in the background with Queueable, Batch, or Scheduled Apex, so the code that
changes records does not wait for the Checks. Record Health Check provides a ready-made class for
each, and you can also write your own class that calls rhc.RecordHealthCheck.evaluate.
| Need | Guide |
|---|---|
| Check up to 200 known records in a later transaction | Run Record Health Check from Queueable Apex |
| Check up to 2,000 known records, or millions found by a query | Check many records with Batch Apex |
| Check records on a recurring schedule | Run Record Health Check from Scheduled Apex |
Move existing @future code | Replace a Future method with Queueable Apex |
| Packaged class | Starts with | Records |
|---|---|---|
rhc. | rhc. | 1–200 known IDs |
rhc. | rhc. | 1–2,000 known IDs |
rhc. | rhc. | 1–2,000 known IDs, every day at 2:00 AM |
The packaged classes return only a job ID; they do not return or save results. To receive their
results, pass ACTIONABLE or ALL and receive the Platform Events, as described in
Save or send results after a run. To save results directly, write
your own class.
Every packaged class requires the Record Health Check Run custom permission, which Record Health Check User includes, when the job is submitted and again when it runs. A completed job in Setup → Apex Jobs does not mean that every record passed.