Newer Version Available
PlatformStatusAlertEvent
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
| Subscriber | Supported? |
|---|---|
| Apex Triggers | ![]() |
| Flows | ![]() |
| Processes | ![]() |
| Pub/Sub API | ![]() |
| Streaming API (CometD) | ![]() |
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
| Field | Details |
|---|---|
| ApiErrorCode |
|
| ComponentName |
|
| EventDate |
|
| EventIdentifier |
|
| EventUuid |
|
| ExtendErrorCode |
|
| RelatedEventIdentifier |
|
| ReplayId |
|
| RequestId |
|
| ServiceJobId |
|
| ServiceName |
|
| StatusType |
|
| SubComponentName |
|
| Subject |
|
| UserId |
|
| Username |
|
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
