Newer Version Available
Create Legacy Transaction Security Policies
| Available in: Salesforce Classic and Lightning Experience |
| Available in: Enterprise, Unlimited, and
Developer Editions Requires Salesforce Shield or Salesforce Event Monitoring add-on subscriptions. |
| User Permissions Needed | |||
|---|---|---|---|
| To create, edit, and manage transaction security policies: |
Customize Application |
||
| To manage transaction security policies: |
Author Apex |
||
You can create multiple policies for the same type of event, but we recommend that your policies and their actions don't overlap. If multiple policies with the same action for a given event execute when the event occurs, their order of execution is indeterminate.
- From Setup, enter Transaction in the Quick Find box, select Transaction Security Policies, and then click New.
- Click Apex then Next.
- Click Transaction Security Policy (the legacy version of transaction security).
-
Select the event type and associated resource that your policy monitors.
- If you’re creating an Apex-based policy in a non-production environment, in Apex Class, select New Empty Apex Class. (Transaction Security creates a stub, or placeholder, Apex policy condition.) Otherwise, use an existing Apex policy condition.
-
Select what the policy does when triggered and who is notified and how. Any
users you select must have Modify All Data and View Setup permissions.
The actions available vary depending on the event type. For login and resource events, you can also block the action or require a higher level of access control with multi-factor authentication. For Chatter events, you can freeze the user or block the post. For Login events, you can require ending an existing session before continuing with the current session. You can set the default action for ending a session to always close the oldest session. For more information, see What Are Transaction Security Actions?
If you’re creating an Apex-based policy and use an API callout in the Apex class, you must select an action. If you select None as the action, the policy can’t execute.
Enter a user that has Modify All Data and View Setup permissions in the Execute Policy As field. However, the automated process user always executes the policy, regardless of the user you enter.
- Choose a descriptive name for your policy. Your policy 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.
- To enable the policy after you create it, in Status, switch to Enabled. (You can always disable it later from the Transaction Security Policies page.)
- Click Finish.
If you’re in a non-production environment and you selected New Empty Apex Class for your new policy, modify the generated Apex class now before activating your policy. Click the Apex class name to get started, and add the condition that triggers the policy. See Apex Policies for Legacy Transaction Security for examples.