Newer Version Available

This content describes an older version of this product. View Latest

LogoutEventStream (Pilot)

LogoutEventStream represents an event associated with a user UI logout. A logout event records a successful logout of a user from your org’s UI. This object is read only and can’t be retrieved using a SOQL query. This object is available in API version 41.0 and later.

We provide the LogoutEventStream object to selected customers through a pilot program that requires agreement to specific terms and conditions. To be nominated to participate in the program, contact Salesforce. Pilot programs are subject to change, and we can’t guarantee acceptance. LogoutEventStream isn’t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. 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. You can provide feedback and suggestions for the LogoutStreamEvent object in the Salesforce Identity group in the Trailblazer Community.

Note

Once LogoutEventStream is enabled, Salesforce publishes logout events and you can add an Apex trigger to subscribe to those events. You can then implement custom logic during logout. For example, you can revoke all refresh tokens for a user at logout.

Supported Calls

describeSObjects()

Fields

Field Name Details
EventDate
Type
datetime
Properties
Filter, Nillable, Sort
Description
Represents when the event started.
EventIdentifier
Type
string
Properties
Filter, Group, Nillable, Sort
Description
Represents the event ID for correlation purposes.
LoginKey
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The string that ties together all events in a given user’s login session. It starts with a login event and ends with either a logout event or the user session expiring.
RelatedEventIdentifier
Type
string
Properties
Filter, Group, Nillable, Sort
Description
Represents the EventIdentifier of the related event.
ReplayId
Type
string
Properties
Filter, Nillable, Sort
Description
Represents the Numeric ID that identifies the logout event. Each ID is incremented automatically and guaranteed to be higher than the ID of the previous event, but not necessarily contiguous for consecutive events.
SessionKey
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The user’s unique session ID. You can use this value to identify all user events within a session. When a user logs out and logs in again, a new session is started.
UserId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
Represents the ID of the user associated with the logout event.
Username
Type
string
Properties
Filter, Group, Nillable, Sort
Description
Represents the username of the user associated with the logout event.

Usage

In this example, the subscriber inserts a custom logout event record during logout.

1trigger LogoutEventTrigger on LogoutEventStream (after insert) { 
2  LogoutEventStream event = Trigger.new[0];
3  LogoutEvent__c record = new LogoutEvent__c();
4  record.EventIdentifier__c = event.EventIdentifier;
5  record.UserId__c = event.UserId;
6  record.Username__c = event.Username;
7  record.EventDate__c = event.EventDate;
8  record.RelatedEventIdentifier__c = event.RelatedEventIdentifier;
9  record.SessionKey__c = event.SessionKey;
10  record.LoginKey__c = event.LoginKey;
11  insert(record);
12}