Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
TriggerContext Class
Namespace
TriggerContext Properties
The following are properties for TriggerContext.
lastError
Signature
public String lastError {get;}
Property Value
Type: String
Usage
The error message that this property returns is the message that was passed in when creating the EventBus.RetryableException exception, as follows.
1throw new EventBus.RetryableException(
2 'Condition is not met, so retrying the trigger again.');retries
Signature
public Integer retries {get;}
Property Value
Type: Integer
TriggerContext Methods
The following are methods for TriggerContext.
currentContext()
getResumeCheckpoint()
Signature
public String getResumeCheckpoint()
Return Value
Type: String
setResumeCheckpoint(resumeReplayId)
Signature
public void setResumeCheckpoint(String resumeReplayId)
Parameters
-
resumeReplayId:
Type: String
The replay ID of the last successfully processed platform event message, after which to resume processing in a new trigger execution context.
Return Value
Type: void
Usage
The method throws an EventBus.InvalidReplayIdException if the supplied Replay ID is not valid—the replay ID is not in the current trigger batch of events, in the Trigger.new list.
Example
This snippet shows how to call the method and pass in the replayId property of an event instance.
1EventBus.TriggerContext.currentContext().setResumeCheckpoint(event.replayId);