TransactionSecurityPolicy
This type extends the Metadata metadata type and inherits its fullName field.
File Suffix and Directory Location
TransactionSecurityPolicy components have the suffix .transactionSecurityPolicy and are stored in the transactionSecurityPolicies folder.
Version
TransactionSecurityPolicy components are available in API version 35.0 and later.
Fields
Field Name | Field Type | Description |
---|---|---|
action | TransactionSecurityAction | Required. Describes the action to take when the matching Transaction Security policy is triggered. |
active | boolean | Required. If true, the policy is enabled and actively monitors its event. |
apexClass | string | Required for Apex-based policies, and optional for all other policies. The name of the class that implements the TxnSecurity.PolicyCondition or TxnSecurity.EventCondition interface for this policy. Available in API version 46.0 and later. |
blockMessage | string | The custom message sent to a user when a policy blocks their action. Used in
Real-Time Event Monitoring only. Maximum of 1000 characters. This field is null when
the default message option is selected in the UI. Available only when
eventName is set to ApiEvent, ListViewEvent, BulkApiResultEventStore, or ReportEvent. Available in API version 49.0 and later.
Include org- or policy-specific information in your custom message, such as the name of the responsible administrator or the business unit. Be careful about what you include. Too much information on how the policy was designed. can aid a malicious user. Two-factor authentication (2FA) isn’t supported in Lightning Experience, so events like ListView and ReportEvent are upgraded to Block in Lightning. Custom messages aren’t translatable. |
customEmailContent | string | The administrator-created custom email content sent when a policy is triggered.
Used in Real-Time Event Monitoring only. Maximum of 1333 characters. This field is
null when the Custom Email Content setting is selected in the UI but no message
content is entered. Available in API version 54.0 and later. Custom messages aren’t translatable. |
description | string | A description of the policy. |
developerName | string |
This unique name prevents conflicts with
other policies that have the same masterLabel. This name
can contain only underscores and alphanumeric characters, and must be unique in your
org. It must begin with a letter, not include spaces, not end with an underscore,
and not contain two consecutive underscores.
Only users with View DeveloperName OR View Setup and Configuration permission can view, group, sort, and filter this field. |
eventName | TransactionSecurityEventName (enumeration of type string) | Used in Real-Time Event Monitoring only. Indicates the name of the event the
policy monitors. This field is available in API 45.0 and later. Valid values are:
|
eventType | MonitoredEvents (enumeration of type string) | Used in Legacy Transaction Security only. Required for Apex-based policies, and
optional for all other policies. Indicates which type of event is being monitored.
Valid values are:
As of Summer '20, Legacy Transaction Security is a retired feature in all Salesforce orgs. |
executionUser | string | Used in Legacy Transaction Security only. The name or ID of an active user who
is assigned the Modify All Data and View Setup user permissions.
As of Summer '20, Legacy Transaction Security is a retired feature in all Salesforce orgs. |
flow | string | Required only for policies of type CustomConditionBuilderPolicy. The ID of the Flow object that contains the logic the Condition Builder transaction security policy. Available in API version 46.0 and later. |
masterLabel | string |
The label for this object. This display value
is the internal label that is’t translated.
Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations. |
resourceName | string | Used in Legacy Transaction Security only. Required for Apex-based policies, and
optional for all other policies. A resource used to narrow down the conditions under
which the policy triggers. For example, with a DataExport event, you can select a resource Lead to specifically monitor
export activity occurring on your Lead entities. The resources available depend on
the Event Type field. The following valid
resources are grouped by event type.
As of Summer '20, Legacy Transaction Security is a retired feature in all Salesforce orgs. |
type | TxnSecurityPolicyType (enumeration of type string) | The type of validation that the policy uses. The valid values are:
|
TransactionSecurityAction
Describes the action to take when the matching Transaction Security policy is triggered.
Field Name | Field Type | Description |
---|---|---|
block | boolean | If true, the requested operation is blocked. This action only applies to Login and AccessResource events. |
endSession | boolean | Used in Legacy Transaction Security only. If true, a current session must be closed before a new session can be
started. This action only applies to Login events.
As of Summer '20, Legacy Transaction Security is a retired feature in all Salesforce orgs. |
freezeUser | boolean | Used in Legacy Transaction Security only. If true, the user that triggered the policy is frozen. This action only
applies to Chatter resources for Entity events.
As of Summer '20, Legacy Transaction Security is a retired feature in all Salesforce orgs. |
notifications | TransactionSecurityNotification[] | Specifies how to notify the Salesforce administrator when the action is triggered. There can be none, one, or multiple notifications. |
twoFactorAuthentication | boolean | If true, multi-factor authentication (MFA)
is required for a higher level of access before the requested operation can
continue. This action only applies to Login and AccessResource
events.
Multi-factor authentication was formerly called two-factor authentication. |
TransactionSecurityNotification
Describes who to notify and how to notify them when the matching Transaction Security policy is triggered.
Field Name | Field Type | Description |
---|---|---|
inApp | boolean | True if an in-app notification is selected. |
sendEmail | boolean | True if an email notification is selected. |
user | string | The user to receive the notification. |
Declarative Metadata Sample Definition
The following is an example of a Real-Time Event Monitoring TransactionSecurityPolicy component.
<?xml version="1.0" encoding="UTF-8"?>
<TransactionSecurityPolicy xmlns="http://soap.sforce.com/2006/04/metadata">
<action>
<block>true</block>
<notifications>
<inApp>true</inApp>
<sendEmail>true</sendEmail>
<user>user@your.org</user>
</notifications>
<twoFactorAuthentication>false</twoFactorAuthentication>
</action>
<active>true</active>
<apexClass>TxnSecMDApiPolicyEventCondition</apexClass>
<blockMessage>You cannot view this report.</blockMessage>
<developerName>TxnSecPolicyMDApi</developerName>
<eventName>ReportEvent</eventName>
<masterLabel>Txn Sec MD Api Policy</masterLabel>
<type>CustomApexPolicy</type>
</TransactionSecurityPolicy>
The following is an example package manifest used to deploy or retrieve the transaction security metadata for an organization.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>MySecurityPolicy</members>
<name>TransactionSecurityPolicy</name>
</types>
<version>35.0</version>
</Package>
Wildcard Support in the Manifest File
This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.