PlatformStatusAlertEvent

Notifies subscribers of alerts that occur during the processing of a user request or service job execution. This object is available in API version 45.0 and later.

For example, suppose that a formula is evaluated as part of processing user requests. A platform event message can be generated during the processing of a user request when an error is encountered from evaluating an invalid formula.

Supported Calls 

describeSObjects()

Supported Subscribers 

SubscriberSupported?
Apex TriggersYes
FlowsYes
ProcessesYes
Pub/Sub APIYes
Streaming API (CometD)Yes

Subscription Channel 

/event/PlatformStatusAlertEvent

Special Access Rules 

Accessing this object requires the Customize Application, Modify All Data, or Manage Next Best Action Strategies user permission.

Event Delivery Allocation Enforced 

Yes

Fields 

ApiErrorCode 

Type: string

Properties: Nillable

Description: The API error code.

ComponentName 

Type: string

Properties: Nillable

Description: Name of the component in which the alert occurred.

EventDate 

Type: datetime

Properties: Nillable

Description: Date and time when the event occurred. Example: 2018-12-18 21:59:48

EventIdentifier 

Type: string

Properties: Nillable

Description: Unique identifier of the event. This field is reserved for future use and is always null in API version 45.0.

EventUuid 

Type: string

Properties: Nillable

Description: A universally unique identifier (UUID) that identifies a platform event message. This field is available in API version 52.0 and later.

ExtendErrorCode 

Type: string

Properties: Nillable

Description: Extended error code which provides more details about the issue.

RelatedEventIdentifier 

Type: string

Properties: Nillable

Description: EventIdentifier (uuid) of the related event. This field is reserved for future use and is always null in API version 45.0.

ReplayId 

Type: string

Properties: Nillable

Description: Represents an ID value that is populated by the system and refers to the position of the event in the event stream. Replay ID values aren’t guaranteed to be contiguous for consecutive events. A subscriber can store a replay ID value and use it on resubscription to retrieve missed events that are within the retention window.

RequestId 

Type: string

Properties: Nillable

Description: The unique ID of the service job that fired the event. It can be used to correlate the alert with logging information.

ServiceJobId 

Type: string

Properties: Nillable

Description: Service-specific job ID, if one exists. For Next Best Action, the service job ID is executionToken. This field can be used to correlate the alert with logging information.

ServiceName 

Type: string

Properties: Nillable

Description: Name of the service that triggered the alert.

StatusType 

Type: string

Properties: Nillable

Description: Status of the event.

SubComponentName 

Type: string

Properties: Nillable

Description: Name of the subcomponent where the alert occurs.

Subject 

Type: string

Properties: Nillable

Description: Short description of the alert.

UserId 

Type: reference

Properties: Nillable

Description: ID of the user who caused the event.

Username 

Type: string

Properties: Nillable

Description: Username of the user who caused the event.

Usage 

The following example shows how to process platform status alert events. Only internal services can publish these events. This Apex trigger example fires when a platform event message is published and creates a Chatter post on the admin profile with event details.

1trigger PlatformStatusAlertEventTrigger on PlatformStatusAlertEvent (after insert) {
2    List<Feeditem> posts = new List<Feeditem>();
3    Id profileId = [select Id from User where User.Profile.Name = 'System Administrator' limit 1].Id;
4    
5    for(PlatformStatusAlertEvent e : trigger.new) {        
6       Feeditem post = New Feeditem();
7       post.ParentId= profileId;
8       post.Body = 'Alert occured in the service: ' + e.ServiceName + '\n' +
9            'APIErrorCode: ' + e.APIErrorCode + '\n' +
10            'ComponentName: ' + e.ComponentName + '\n' +
11            'EventDate: ' + e.EventDate + '\n'+
12            'EventIdentifier: ' + e.EventIdentifier + '\n' +
13            'ExtendedErrorCode: '+ e.ExtendedErrorCode + '\n' +
14            'RelatedEventIdentifier: ' + e.RelatedEventIdentifier + '\n' +
15            'ReplayId: ' + e.ReplayId + '\n' +
16            'RequestId: ' + e.RequestId + '\n' +
17            'ServiceJobId: ' + e.ServiceJobId + '\n' +
18            'ServiceName: ' + e.ServiceName + '\n'+
19            'StatusType: ' + e.StatusType + '\n' +
20            'SubComponentName: ' + e.SubComponentName + '\n' +
21            'Subject: '+ e.Subject + '\n' +
22            'UserId: ' + e.UserId + '\n' +
23            'Username: ' + e.Username + '\n';
24       posts.add(post);
25    }
26    if (posts.size() > 0) {
27        insert(posts);
28    }
29}

Example 

The code example ultimately displays as a Chatter post that contains the following:

Alert occurred in the service: Next Best Action Strategy

APIErrorCode: INVALID_OPERATION

ComponentName: Strategy_for_error_event_demo

EventDate: 2018-12-18 21:59:48

EventIdentifier: null

ExtendedErrorCode: FORMULA_EXPRESSION_INVALID

RelatedEventIdentifier: null

ReplayId: 63

RequestId: TID:89715900005e40b69a

ServiceJobId: 1014fd4e-4a19-4910-be36-377a7f2f1b75

ServiceName: Next Best Action Strategy

StatusType: Error

SubComponentName: filter_node1

Subject: Something went wrong with filter element ‘filter_node1’: ‘Unknown function ISBLANC. Check spelling.’

UserId: 005RM000001ZnzAYAS

Username: xxx@yyy.com