Newer Version Available
Create Transaction Security Policies
| Available in: Salesforce Classic and Lightning Experience |
| Available in: Enterprise, Performance,
Unlimited, and Developer Editions Requires purchasing 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.
- If you are participating in the Real-Time Events pilot, select whether you want to create a policy with the Condition Builder wizard or with an Apex class. If you’re not in the pilot, skip to step 3.
-
Select the event or entity 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. If
you’re creating an Apex-based policy, specify the user that the policy executes
as. 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 two-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?
- 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 Transaction Security for examples.