AssetTokenEvent
An asset token event records successful completion of an OAuth 2.0 asset token flow for a connected device. An event is published whenever an access token and actor token (optional) are successfully exchanged for an asset token. This object is designed to support custom business processes, such as automatic logging of a case when an event occurs. Create Apex triggers that subscribe to an event and execute after asset token issuance. This object is read only and can’t be retrieved using a SOQL query. Asset token events are not displayed in the Setup user interface for Platform Events.
Supported Calls
describeSObjects()
Supported Subscribers
| Subscriber | Supported? |
|---|---|
| Apex Triggers | ![]() |
| Flows | |
| Processes | |
| Pub/Sub API | ![]() |
| Streaming API (CometD) | ![]() |
Subscription Channel
/event/AssetTokenEvent
Event Delivery Allocation Enforced
Yes
Fields
ActorTokenPayload
Type: textarea
Properties: Nillable
Description: If the asset token request included an actor token, the payload portion containing claims about the connected device, asset token, and if applicable, the registered Asset.
AssetId
Type: reference
Properties: Nillable
Description: ID of the Asset record if the Asset was newly created or an existing Asset was linked to in the asset token request.
AssetName
Type: string
Properties: Nillable
Description: If specified in the actor token, the display name of the existing Asset. This value is otherwise null.
AssetSerialNumber
Type: string
Properties: Nillable
Description: If specified in the actor token, the serial number of the existing Asset. This value is otherwise null.
ConnectedAppId
Type: reference
Properties: Nillable
Description: ID of the connected app associated with the access token for the device.
DeviceId
Type: string
Properties: Nillable
Description: ID of the connected device. Value is the did (device ID) claim specified in the actor token.
DeviceKey
Type: textarea
Properties: Nillable
Description: If specified in the actor token, the device-specific RSA public key as a JSON Web Key (JWK). Value is the jwk claim within the confirmation claim from the actor token.
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.
Expiration
Type: dateTime
Properties: Nillable
Description: The expiration time on or after which the asset token JWT must not be accepted for processing. A numeric value representing the number of seconds from 1970-01-01T00:00:00Z UTC until the specified UTC date/time, ignoring leap seconds.
ExternalClientApplicationId
Type: reference
Properties: Nillable
Description: For internal use only.
Name
Type: string
Properties: Nillable
Description: Display name of the asset token.
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.
UserId
Type: reference
Properties: Nillable
Description: ID of the user associated with the access token.
Usage
The following example shows how to trigger an action after an asset token event.
1trigger AssetTokenEventTrigger on AssetTokenEvent (after insert) {
2 System.assertEquals(1,Trigger.new.size(),'One record expected');
3 AssetTokenEvent event = Trigger.new[0];
4 AssetTokenRecord__c record = new AssetTokenRecord__c();
5 record.ConnectedAppId__c = event.ConnectedAppId;
6 record.UserId__c = event.UserId;
7 record.AssetId__c = event.AssetId;
8 record.AssetTokenName__c = event.AssetTokenName;
9 record.DeviceId__c = event.DeviceId;
10 record.DeviceKey__c = event.DeviceKey;
11 record.Expiration__c = event.Expiration;
12 record.AssetSerialNumber__c = event.AssetSerialNumber;
13 record.AssetName__c = event.AssetName;
14 record.ActorTokenPayload__c = event.ActorTokenPayload;
15 insert(record);
16}