Event Class

Contains event information that the evaluate method uses to evaluate a transaction security policy.

TxnSecurity

The Event class contains the information needed to determine if the event triggers a Transaction Security policy. Not all class attributes are used for every type of event.

The EventClass interface applies only to Legacy Transaction Security, which is a retired feature as of Summer ‘20. Use the EventCondition interface instead of the EventClass interface.

The following is the constructor for Event.

  • Event()

    Creates an instance of the TxnSecurity.Event class.

Creates an instance of the TxnSecurity.Event class.

public Event()

The following are properties for Event.

  • action

    Specifies the action being taken on the resource for an Entity event. For example, a Login IP resource for an Entity event could have an action of create. The action attribute is not used by any other event type.

  • data

    Contains data used by actions. For example, data for a login event includes the login history ID. Returns a map whose keys are the type of event data, like SourceIp.

  • entityId

    The ID of any entity associated with the event. For example, the entityId of a DataExport event for an Account object contains the Account ID.

  • entityName

    The name of the object the event acts on.

  • organizationId

    The ID of the Salesforce org where the event occurred.

  • resourceType

    The type of resource for the event. For example, an AccessResource event could have a Connected Application as a resource type. Not all event types have resources.

  • timeStamp

    The time the event occurred.

  • userId

    Identifies the user that caused the event.

Specifies the action being taken on the resource for an Entity event. For example, a Login IP resource for an Entity event could have an action of create. The action attribute is not used by any other event type.

public String action {get; set;}

Type: String

Contains data used by actions. For example, data for a login event includes the login history ID. Returns a map whose keys are the type of event data, like SourceIp.

public Map<String,String> data {get; set;}

Type: Map<String, String>

The following table lists all the available data types. Not all types appear with all event types. The data type values are always string representations. For example, the isApi value is a string in the map, but is actually a Boolean value. Convert the value from a string to its true type this way: Boolean.valueOf(event.data.get('isApi'));

Key NameTrue Value TypeEvents Supported
ActionNameString Values are:
  • Convert
  • Delete
  • Insert
  • Undelete
  • Update
  • Upsert
Entity
ApiTypeString (Enum manifested as a String)DataExport, Login
ApplicationStringAccessResource, DataExport
ClientIdString (ID of the client)DataExport
ConnectedAppIdString (ID of the Connected App)AccessResource, DataExport
ExecutionTimemillisecondsDataExport
IsApiBooleanDataExport
IsScheduledBooleanDataExport
LoginHistoryIdStringDataExport, Login
NumberOfRecordsIntegerDataExport
PolicyIdString (ID of the current policy)All events
SessionLevelString (Enum manifested as a String. Values include STANDARD and HIGH_ASSURANCE)AccessResource
SourceIpString (IPV4 Address)AccessResource
UserNameStringEntity

The ID of any entity associated with the event. For example, the entityId of a DataExport event for an Account object contains the Account ID.

public String entityId {get; set;}

Type: String

The name of the object the event acts on.

public String entityName {get; set;}

Type: String

The ID of the Salesforce org where the event occurred.

public String organizationId {get; set;}

Type: String

The type of resource for the event. For example, an AccessResource event could have a Connected Application as a resource type. Not all event types have resources.

public String resourceType {get; set;}

Type: String

The time the event occurred.

public Datetime timeStamp {get; set;}

Type: Datetime

Identifies the user that caused the event.

public String userId {get; set;}

Type: String