Newer Version Available
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
| Field Name | Details |
|---|---|
| ActorTokenPayload |
|
| AssetId |
|
| AssetName |
|
| AssetSerialNumber |
|
| ConnectedAppId |
|
| DeviceId |
|
| DeviceKey |
|
| EventUuid |
|
| Expiration |
|
| Name |
|
| ReplayId |
|
| UserId |
|
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}