---
schema_version: "1"
id: 6c5017ed3af00c782c12fbe057608a2cec6befe1fe0e7ce0b169ac394189945b
title: Event Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_TxnSecurity_Event.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_TxnSecurity_Event.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7218d4533cfd99acb9a84af9d1c1a3659e879ae556bf414dab0add5adb25b681
description: Contains event information that the evaluate method uses to evaluate a transaction security policy.Creates an instance of the TxnSecurity.Event class.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.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.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.The name of the object the event acts on.The ID of the Salesforce org where the event occurred.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.The time the event occurred.Identifies the user that caused the event.
---
# Event Class

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

## Namespace

[TxnSecurity](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_TxnSecurity.htm "The TxnSecurity namespace provides an interface used for transaction security.")

## Usage

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.

![Tip](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/images/icon_note_tip.png)

#### Tip

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.

- **[Event Constructors](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_TxnSecurity_Event.htm#apex_TxnSecurity_Event_constructors)**
- **[Event Properties](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_TxnSecurity_Event.htm#apex_TxnSecurity_Event_properties)**

## Event Constructors

The following is the constructor for Event.

- **[Event()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_TxnSecurity_Event.htm#apex_TxnSecurity_Event_ctor)**  
    Creates an instance of the TxnSecurity.Event class.

### Event()

Creates an instance of the TxnSecurity.Event class.

#### Signature

public Event()

## Event Properties

The following are properties for Event.

- **[action](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_TxnSecurity_Event.htm#apex_TxnSecurity_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](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_TxnSecurity_Event.htm#apex_TxnSecurity_Event_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](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_TxnSecurity_Event.htm#apex_TxnSecurity_Event_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](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_TxnSecurity_Event.htm#apex_TxnSecurity_Event_entityName)**  
    The name of the object the event acts on.
- **[organizationId](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_TxnSecurity_Event.htm#apex_TxnSecurity_Event_organizationId)**  
    The ID of the Salesforce org where the event occurred.
- **[resourceType](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_TxnSecurity_Event.htm#apex_TxnSecurity_Event_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](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_TxnSecurity_Event.htm#apex_TxnSecurity_Event_timeStamp)**  
    The time the event occurred.
- **[userId](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_TxnSecurity_Event.htm#apex_TxnSecurity_Event_userId)**  
    Identifies the user that caused the 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.

#### Signature

public String action {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data 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.

#### Signature

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

#### Property Value

Type: [Map](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_map.htm#apex_methods_system_map "Contains methods for the Map collection type.")<[String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type."), [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")\>

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'));

<table class="featureTable sort_table" summary="">



                      <thead class="thead sorted" align="left">
                        <tr>
                          <th class="featureTableHeader  " id="d1789513e437">Key Name</th>

                          <th class="featureTableHeader  " id="d1789513e440">True Value Type</th>

                          <th class="featureTableHeader  " id="d1789513e443">Events Supported</th>

                        </tr>

                      </thead>

                      <tbody class="tbody">
                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">ActionName</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type">
                            <samp class="codeph apex_code"><span class="keyword">String</span></samp> Values are:<ul class="ul bulletList">
                              <li class="li">Convert</li>

                              <li class="li">Delete</li>

                              <li class="li">Insert</li>

                              <li class="li">Undelete</li>

                              <li class="li">Update</li>

                              <li class="li">Upsert</li>

                            </ul>
                          </td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">Entity</td>

                        </tr>

                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">ApiType</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type">
                            <samp class="codeph apex_code"><span class="keyword">String</span></samp> (Enum manifested as a
                            String)
                          </td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">DataExport, Login</td>

                        </tr>

                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">Application</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type"><samp class="codeph apex_code"><span class="keyword">String</span></samp></td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">AccessResource, DataExport</td>

                        </tr>

                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">ClientId</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type">
                            <samp class="codeph apex_code"><span class="keyword">String</span></samp> (ID of the client)
                          </td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">DataExport</td>

                        </tr>

                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">ConnectedAppId</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type">
                            <samp class="codeph apex_code"><span class="keyword">String</span></samp> (ID of the Connected
                            App)
                          </td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">AccessResource, DataExport</td>

                        </tr>

                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">ExecutionTime</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type">milliseconds</td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">DataExport</td>

                        </tr>

                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">IsApi</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type"><samp class="codeph apex_code"><span class="keyword">Boolean</span></samp></td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">DataExport</td>

                        </tr>

                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">IsScheduled</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type"><samp class="codeph apex_code"><span class="keyword">Boolean</span></samp></td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">DataExport</td>

                        </tr>

                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">LoginHistoryId</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type"><samp class="codeph apex_code"><span class="keyword">String</span></samp></td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">DataExport, Login</td>

                        </tr>

                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">NumberOfRecords</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type"><samp class="codeph apex_code"><span class="keyword">Integer</span></samp></td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">DataExport</td>

                        </tr>

                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">PolicyId</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type">
                            <samp class="codeph apex_code"><span class="keyword">String</span></samp> (ID of the current
                            policy)
                          </td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">All events</td>

                        </tr>

                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">SessionLevel</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type">
                            <samp class="codeph apex_code"><span class="keyword">String</span></samp> (Enum manifested as a
                            String. Values include <samp class="codeph apex_code">STANDARD</samp> and
                            <samp class="codeph apex_code">HIGH_ASSURANCE</samp>)
                          </td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">AccessResource</td>

                        </tr>

                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">SourceIp</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type">
                            <samp class="codeph apex_code"><span class="keyword">String</span></samp> (IPV4
                            Address)
                          </td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">AccessResource</td>

                        </tr>

                        <tr>
                          <td class="entry" headers="d1789513e437" data-title="Key Name">UserName</td>

                          <td class="entry" headers="d1789513e440" data-title="True Value Type"><samp class="codeph apex_code"><span class="keyword">String</span></samp></td>

                          <td class="entry" headers="d1789513e443" data-title="Events Supported">Entity</td>

                        </tr>

                      </tbody>

                    </table>

### 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.

#### Signature

public String entityId {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### entityName

The name of the object the event acts on.

#### Signature

public String entityName {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### organizationId

The ID of the Salesforce org where the event occurred.

#### Signature

public String organizationId {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### 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.

#### Signature

public String resourceType {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### timeStamp

The time the event occurred.

#### Signature

public Datetime timeStamp {get; set;}

#### Property Value

Type: [Datetime](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_datetime.htm#apex_methods_system_datetime "Contains methods for the Datetime primitive data type.")

### userId

Identifies the user that caused the event.

#### Signature

public String userId {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")