Skip to content

Decide when to use Platform Events

Detailed page. Use “On this page” to jump directly to the section you need.

Decide whether a separate Flow, Apex trigger, or external integration needs a Check Set summary or individual Check results after a health-check run completes successfully.

Event navigation: Publication behavior · Build receiving automation · Subscribe externally · Look up event fields

Use these Platform Events only when the result returned directly to Lightning, Flow, or Apex is not enough and a separate process must also receive completion information. This page explains exactly what publishes, which setting controls it, what each event contains, and what receiving automation must handle.

Start with the Check Set Run event when the receiving process needs one summary per record. Add Check Result events only when it needs the status, Reason Code, and severity for individual Checks.

If only a person on the card should publish events:

  1. In Setup → Custom Metadata Types → Record Health Check Set → Manage Records, open the Set and enable Publish User Run Event.
  2. In Setup → Custom Metadata Types → Record Health Check → Manage Records, enable Publish User Result Event only on Checks whose individual results a receiver needs.
  3. Keep When Checks Run as When the user clicks Run and keep Run or Rerun visible. Page-load evaluation never publishes result events.
  4. Build and test the receiver before enabling publication in production.
  5. Assign event object access to the receiving Flow user, Apex context, or integration. The packaged Card User, User, and Admin Permission Sets include Set Run and Check Result access, but not the restricted Log event.

Flow, Apex, Queueable, Batch, and Scheduled callers ignore those two card checkboxes and use their own NONE, ACTIONABLE, or ALL request value.

Another process needs…EventUse
One summary for a completed Check SetRecord_Health_Check_Set_Run__eFor the card, Publish User Run Event. For Apex or Flow, choose ACTIONABLE or ALL.
One result for selected ChecksRecord_Health_Check_Result__eFor the card, each Check’s Publish User Result Event. For Apex or Flow, choose ACTIONABLE or ALL.
Restricted Record Health Check error detailsRecord_Health_Check_Log__eCheck Set Publish Error Log Event (off by default; enable after assigning the publisher permission)
The immediate decision in the current transactionNeither lifecycle eventUse the Lightning, Apex, or Flow response instead

The Set Run and Check Result events are high-volume Platform Events configured as Publish After Commit. They carry the evaluated record’s ID in RecordId__c when one is available, but exclude queries, messages, user identity, and field values. Automatic record-page checks never publish; explicit Run and Rerun actions can publish when enabled.

Publish After Commit means Salesforce delivers the event only if the transaction that ran the health check completes successfully. This prevents another process from acting on a result from work that Salesforce later rolled back. The caller cannot wait for the receiving process or use the event for an immediate decision; Flow and Apex must branch on the result returned directly to them.

Text fallback:

Caller -> Record Health Check -> direct response
|
+-> transaction commits -> event bus -> receiving process
|
+-> transaction rolls back -> no lifecycle event
Receiving-process failure is monitored and recovered separately from the original response.
  • Minimal completion facts for one Check Set run and its server-finalized Check results.
  • A way for a separate process to build history, notifications, exports, analytics, or other automation without coupling to the health-check call itself.
  • They are not the result returned directly to Lightning, Flow, or Apex.
  • They are not a guaranteed or permanent audit log; Salesforce retains high-volume platform events for 72 hours, not indefinitely.
  • They are not exactly-once commands. Receiving automation must handle repeated and replayed events safely.
  • Publish acceptance does not prove delivery or successful receiving-process work.

For the end-to-end model, start with Integrate Record Health Check.

  1. Assign the receiving user access to the selected Platform Event and choose Flow, Apex, or Pub/Sub API for the receiving process. Custom fields on these Platform events are not field-level-security permissionable; granting event object access is enough for field visibility in receiving tools. The Card User, User, and Admin Permission Sets grant create/read on Set Run and Check Result events. They do not grant Record_Health_Check_Log__e; grant Log object access separately to the users or integration that receive error diagnostics.
  2. In a sandbox, enable Publish User Run Event on one Check Set. Leave Check publication off for the first test.
  3. Subscribe before clicking Run or Rerun; automatic page load cannot publish.

If an automatic Check Set uses Run Button Display = Hide, users cannot publish lifecycle events from that card because Run and Rerun are not available. A manual Check Set cannot use Hide because users would have no way to start it. 4. Verify one COMPLETED Set event after commit, then test rollback, replay, and duplicate handling. 5. Enable individual Check events only after the Set receiving process is operating within event allocations.

Publishing runs from deliberate public Apex, packaged Flow, and user-initiated Lightning component runs. Automatic Lightning record-page runs never publish.

Source constantMeaning in shipped callers
APEX_APIPublic RecordHealthCheck Apex methods
FLOWPackaged Flow actions
USER_INITIATEDAn explicit Run or Rerun action in the Lightning component
SCHEDULEDPackaged scheduled Apex adapter
BATCHPackaged Batch Apex adapter
QUEUEABLEPackaged Queueable Apex adapter
FUTUREAttribution value for legacy future callers migrating to Queueable
AGENTAttribution value for agent/tool callers that use the public Apex API
RUN_ON_LOADLightning automatic page load; controller keeps publication off

Lightning automatic loads never publish. Programmatic callers publish only when they select ACTIONABLE or ALL; they do not use the Lightning-card publication checkboxes. Receiving automation must not start another publishing health-check run indefinitely from the event it receives.

Keeping page-load publication off protects Platform Event allocations. Each published event still carries the caller’s source so operators can see which entry point produced it.

Publish failures are logged and do not change Check or Check Set results.

Events are chunked in batches of 100 (PUBLISH_CHUNK_SIZE).

The control depends on what starts the run.

User selects Run or Rerun on the Lightning card

Section titled “User selects Run or Rerun on the Lightning card”
Setup fieldDefaultWhat it controls
Check Set Publish User Run Event (PublishUserRunEvent__c)OffOne Check Set Run event for the evaluated record after the explicit card run completes.
Check Publish User Result Event (PublishUserResultEvent__c)OffOne Check Result event for that Check after the explicit card run completes, regardless of whether its result is PASS, FAIL, SKIPPED, UNABLE_TO_EVALUATE, or ERROR.

Automatic page load, browser refresh, and save-driven RefreshView reruns never publish these result events. If Run Button Display is Hide, the user has no Run or Rerun action to publish them.

Flow, Apex, Queueable, Batch, or Scheduled Apex starts the run

Section titled “Flow, Apex, Queueable, Batch, or Scheduled Apex starts the run”

The caller’s required Event Publication choice controls publication directly. The Lightning-card checkboxes above are not consulted.

Event PublicationWhat is published
NONENo Check Set Run or Check Result events. Use this when the caller handles or saves the response itself.
ACTIONABLECheck Result events for FAIL, UNABLE_TO_EVALUATE, and ERROR, plus a completed Check Set Run heartbeat for every scanned record. All-pass and all-skipped runs therefore publish the Set Run heartbeat but no Check Result events.
ALLA Check Result event for every result, including PASS and SKIPPED, plus the Check Set Run event.

Check Set Publish Error Log Event (PublishErrorLogEvent__c) is separate from result publication. It is off by default and publishes Record_Health_Check_Log__e when Record Health Check captures an ERROR only after a Set explicitly opts in. Assign the packaged publisher permission to every running identity first. Missing Check Set configuration fails closed without publishing restricted details.

For a user-initiated Lightning run, the completion call publishes the outcomes returned by the progressive browser evaluation after filtering them to the requested record and the Checks in the resolved Check Set. It does not run the Checks again while publishing. These USER_INITIATED events are client-attested advisory notifications, not server-attested compliance evidence. A user with Run permission controls the browser request that supplies the completion statuses.

A receiving process that makes a security-sensitive, compliance, or business-critical change must run the Check again through Apex or Flow before acting. Apex- and Flow-originated events come directly from their server-side evaluations.

FieldValueMeaning
ContractVersion__c1.0Lifecycle event contract (RecordHealthCheckLifecyclePublisher.CONTRACT_VERSION)
FrameworkVersion__cCurrent package valueRecord Health Check implementation version that produced the event

This is separate from the RecordHealthCheckResponse returned directly to Apex. The event and Apex response can change independently, so receiving automation must read the version from the event it is processing.

Receiving integrations should store or inspect ContractVersion__c, not infer the event shape from FrameworkVersion__c. A Record Health Check release can change implementation behavior without changing the event schema; an incompatible event-field change requires a new contract version.

The Set Run and Check Result events intentionally omit:

  • User Id
  • User-facing messages
  • Found / Expected values
  • SOQL and formula source
  • adminDetail text

They include RecordId__c when one evaluated record is available. Receiving automation reads additional Salesforce data using their own Salesforce access, the Record ID, metadata Qualified API Names, and RunId__c.


Platform EventDetailed referencePurpose
Record_Health_Check_Set_Run__eCheck Set Run Platform EventOne completion summary and outcome counts for a Check Set run
Record_Health_Check_Result__eCheck Result Platform EventOne finalized public Check outcome
Record_Health_Check_Log__eLog Platform EventRestricted Record Health Check ERROR details
  1. Review org Platform Event allocations and existing receiving Flows, Apex triggers, and integrations.
  2. Enable publication only for deliberate LWC, Apex, Flow, scheduled, or batch runs.
  3. Start with one receiving process in a sandbox, such as a Flow, Apex trigger, or export integration.
  4. Use the Platform Event replay ID and error handling required by your business process. A publication or receiving-process error does not change the completed health result.
  5. Treat RecordId__c as optional and correlate with RunId__c and metadata Qualified API Names.

When an event is missing or processed twice

Section titled “When an event is missing or processed twice”
SymptomLikely causeWhat to investigate
No event after page openAutomatic runs are blocked from publishingClick Run/Rerun or invoke Apex/Flow deliberately
No event after a record-save refreshSave-driven refresh deliberately uses the non-publishing browser lifecycleSelect Run/Rerun or invoke Apex/Flow when publication is required
No event after refreshing a hidden automatic cardPage refresh reevaluates the Check Set but never publishes user-run lifecycle eventsShow Run and Rerun, or call the Check Set from Apex or Flow; metadata validation warns when publication is enabled for a hidden automatic Check Set
No event after selecting Run or Rerun on the cardThe Check Set or Check publication field is off, the transaction rolled back, or publication failedCheck the relevant metadata field, source, logs, and commit outcome.
No event after Flow or ApexEvent Publication is NONE, ACTIONABLE found no actionable result, the transaction rolled back, or publication failedCheck the caller’s Event Publication choice, returned statuses, logs, and commit outcome.
Repeated processingReplay or a receiving-process retry delivered the event againKeep unique by EventId__c; make follow-up work safe to repeat
Two valid events describe near-simultaneous card runsSeparate tabs or intentional reruns completed independentlyTreat delivery as at least once. Keep each EventId__c; apply a reviewed business-window key only if the process must collapse equivalent runs.
Health result succeeded but no requested event arrivedPublication can fail independently and is warning-only to the health callerMonitor Record Health Check logs and receiver health; never treat a successful health response as proof of event delivery.
Missing record contextThe run had no single record, or a record ID was not available at publishCorrelate with RunId__c and metadata names; RecordId__c is set only when available
Receiving process failedIts Salesforce limits, access, or business logic failed after publicationMonitor and retry that process separately; the health result is already final.

Record_Health_Check_Log__e serves a different purpose from the two result events. It carries restricted Record Health Check ERROR details and uses Publish Immediately.

PropertyLifecycle events (Set / Check)Diagnostics event (Log)
PurposeCompletion factsErrors that need reproducing
DefaultOptional per Set/Check (off)Off by default; enable per Check Set with PublishErrorLogEvent__c and the publisher permission
Publish behaviorPublish After CommitPublish Immediately: survives the rollback a failing check triggers
Carries error detailNo: record ID + counts/status onlyYes: record ID plus message, exception type, stack trace
Results includedOnly the results selected by the card metadata or caller’s Event Publication choiceERROR only
AccessUsers and integrations assigned event accessRestricted: grant access only to the error-monitoring users or integration.

The Log event is independent of Publish User Run Event and Publish User Result Event. It is controlled by the Check Set’s default-off Publish Error Log Event field. Its complete event body, security requirements, repeated-call guard, possibilities, and known limitations are in the Log Platform Event reference.