Transaction Security Policies Notify, Ask for Proof, or Block
Tento obsah zatím není dostupný ve vašem jazyce.
Module 3 of 6 in the chapter Monitoring: Real-Time Events, Log Files and Transaction Security, chapter 19 of Securing Salesforce: Sharing and Visibility. Each module stands on its own.
The question this module answers: You can see an event as it happens. How do you make Salesforce act on it: tell someone, ask for more proof, or stop it?
From watching to acting
Section titled “From watching to acting”Here’s the question I get in every class: how do I stop somebody from downloading data?
Everything in module 1 and module 2 tells you what happened. Transaction security lets you do something about it while it’s happening. Salesforce defines it this way: “Transaction Security is a framework that intercepts real-time events and applies appropriate actions to monitor and control user activity.” Each policy has conditions that evaluate events, and actions that run when they’re met: Block, Multi-Factor Authentication and Notifications (Transaction Security (opens in a new tab), Salesforce Help, checked 2026-11-26).
It’s part of the same license as module 2: “Transaction Security is included in Real-Time Event Monitoring,” and it “Requires Salesforce Shield or Salesforce Event Monitoring add-on subscriptions” (same page). Salesforce also ships a default policy on large report exports, which module 4 covers.
And one thing I like about it: these policies work across Salesforce, on standard pages, reports, list views and the API, not just on custom functionality you built.
A condition and an action
Section titled “A condition and an action”Every policy is two things. A condition: which event, and what about it. An action: what Salesforce does when the condition is met.
In class, I go to Setup, open Transaction Security Policies, and click New. The first choice is how to write the condition.
- Condition Builder. Clicks, not code. “When you build your policy using Condition Builder, you choose which fields on these objects you want to monitor for customer activity” (Transaction Security page).
- Apex. A class that “must implement the TxnSecurity.EventCondition interface” (Create a Transaction Security Policy That Uses Apex (opens in a new tab), Salesforce Help, checked 2026-11-26). It has one method,
evaluate, which returns true when the policy should act.
Why would you write code? Because “The conditions available in Condition Builder are a subset of all the event objects fields.” Salesforce’s own example: “Records isn’t available as a Condition Builder condition for the ReportEvent event object. But you can use the ReportEvent.Records field in an Apex” class (Transaction Security page). So start with Condition Builder, and reach for Apex only when the condition needs something the builder can’t see.
Here’s the policy I build in class. Event: a report export. Condition: rows processed greater than 10. Ten rows is a demo number, so you can trip it yourself; a real threshold comes from watching what normal looks like (module 2). Then the real question: what do you want to happen? Notify the manager? Or actually stop it and give them an error?
Three actions
Section titled “Three actions”Salesforce gives you three (Transaction Security Actions and Notifications (opens in a new tab), Salesforce Help, checked 2026-11-26):
- Block. “Don’t let the user complete the request.” The user sees a message explaining why. You can write your own block message, up to 1,000 characters, but only for ApiEvent, ListViewEvent and ReportEvent policies, and “Custom block messages aren’t translated.” If your users work in more than one language, plan for that.
- Multi-factor authentication. Ask for more proof: “Prompt the user to confirm their identity with an additional verification method, such as the Salesforce Authenticator app.” But only where a person is there to answer: “In situations where you can’t use multi-factor authentication (for instance, during an API query), this action changes to a block action.”
- Notifications. An email, with the subject “Transaction Security Alert,” or an in-app notification, on its own or alongside Block or MFA. In-app notifications “aren’t available in Classic.” If you write a custom email, Salesforce “recommends that you include only event information that the recipient is authorized to view.” The alert is a door to sensitive data too.
Read the MFA line twice. A policy that says “ask for proof” turns into “stop it” when the request comes from an integration. That’s often right. But if nobody on the team knows it, it’s the outage nobody can explain.
Which events allow which actions
Section titled “Which events allow which actions”Not every event can take every action. Here’s Salesforce’s table, reduced to the actions (Transaction Security page, checked 2026-11-26):
| Event | What it watches | Block | MFA | Notify |
|---|---|---|---|---|
| ReportEvent | Reports viewed and exported | Yes | For UI logins | Yes |
| ListViewEvent | List views | Yes | For UI logins | Yes |
| LoginEvent | Logins | Yes | For UI logins | Yes |
| ApiEvent | API queries | Yes | No | Yes |
| BulkApiResultEventStore | Bulk API results downloaded | Yes | No | Yes |
| FileEventStore | File downloads and previews | Yes | No | Yes |
| PermissionSetEventStore | Permission set changes | Yes | No | Yes |
| ApiAnomalyEventStore | Threat Detection: API anomalies | No | No | Yes |
| CredentialStuffingEventStore | Threat Detection: credential stuffing | No | No | Yes |
| ReportAnomalyEventStore | Threat Detection: report anomalies | No | No | Yes |
| SessionHijackingEventStore | Threat Detection: session hijacking | No | No | Yes |
Two patterns are worth remembering. The Threat Detection events can only notify, because by the time Salesforce has detected the anomaly, the activity has already happened (module 2). And MFA is only offered where a person might be in front of a screen.
Even there, the fine print matters. The table says of list views: “Multi-factor authentication isn’t supported for list views in Lightning pages, so the action is upgraded to Block” (Transaction Security page). And the Apex page adds: “The two-factor authentication action isn’t available in the Salesforce mobile app, Lightning Experience, or via API for events. Instead, the block action is used” (Apex page). The two pages don’t say exactly which screens prompt and which block. The safe way to teach it: expect MFA to become Block anywhere you’re not sure a person can answer, and test it.
Don’t let policies overlap
Section titled “Don’t let policies overlap”You can write many policies on the same event. Salesforce advises against letting them collide: “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” (Apex page). Indeterminate means you can’t predict it. Give each policy one job, and write down what each one is for.
Notify first, then block
Section titled “Notify first, then block”Here’s the habit that keeps transaction security from becoming the next incident. You need to know what these policies will catch ahead of time, test for them, and then validate them.
Salesforce’s Well-Architected guidance says it plainly: “a Transaction Security policy tuned too aggressively can block valid business activity—so scope these controls to genuine risk, stage them in monitor-only mode before enforcing them, and design a break-glass path for when a control misfires” (Trust (opens in a new tab), Salesforce Architects, Well-Architected, checked 2026-11-26).
In practice, monitor-only means Notifications alone. So:
- Start with notify. Turn the policy on with Notifications only, sent to someone who will read them.
- Read what it catches for a few weeks. Who tripped it? Were they doing their job? A sales operations analyst exporting the whole pipeline every Monday is normal, and the policy shouldn’t punish that.
- Tune the condition until it catches what you meant and little else.
- Then add MFA or Block, and keep the notification, so someone still knows.
And keep the policy in proportion. The same Well-Architected page says transaction security policies “aren’t part of the baseline, they’re an add-on capability that complements the core authorization model,” and that the identity, role, profile, permission set and sharing controls “already establish a secure authorization posture on their own” (Trust). That’s this whole course. A policy doesn’t fix a sharing model that gives everyone everything. It watches the edges of a sharing model that’s already right.
A policy can lock people out
Section titled “A policy can lock people out”A transaction security policy runs during the user’s request. If it’s wrong, the user’s work stops. Salesforce says it directly about Apex policies: “It’s even more important to write tests for your transaction security policy’s Apex code because it executes during critical user actions in your Salesforce org.” A bug in a LoginEvent policy, for example, can lock your users out (Apex page).
Three rules from the same page, dated 2026-11-23:
- No DML. “Don’t include DML statements in your Apex-based policies because they can cause errors.”
- Slow work goes asynchronous. “Use an asynchronous Apex process to offload time-consuming operations, such as sending a notification email to an external recipient.”
- Don’t enable an empty class. If Setup creates the class for you, “don’t enable the policy yet because you must first add code to the class.” The generated code returns false, so it does nothing, but a half-written one might do the wrong thing.
And keep a way back in. For logins, the Identity and Access course covers this in full: what a login policy can see, and my rule to keep at least one user who can get in without the extra rules, a break glass, watched every time it’s used (Transaction Security at the Door). The same thinking applies to any policy that blocks: who fixes it when it blocks the people who’d fix it?
Test knowledge. Know that a transaction security policy is a condition on a real-time event plus an action: Block, multi-factor authentication, or Notifications (email “Transaction Security Alert”, in-app). Know that conditions are built in Condition Builder (a subset of the event’s fields) or in Apex (the TxnSecurity.EventCondition interface, any field, such as ReportEvent.Records). Know which events allow which actions: Block on ApiEvent, BulkApiResultEventStore, FileEventStore, ListViewEvent, LoginEvent, PermissionSetEventStore and ReportEvent; MFA for UI on ListViewEvent, LoginEvent and ReportEvent; Threat Detection events notify only. Know that MFA becomes Block where a person can’t answer, such as the API; that custom block messages are only for ApiEvent, ListViewEvent and ReportEvent and aren’t translated; that overlapping policies run in an unpredictable order; and that you start in monitor-only mode with notifications and test Apex policies, because a bad policy can lock users out. Transaction security needs Shield or the Event Monitoring add-on. A likely area, not a known question.
What an architect decides here
Section titled “What an architect decides here”- Which events need a policy at all, and what each policy is for, one job each, written down.
- Condition Builder or Apex, and who tests and maintains the Apex.
- The action for each policy, and what happens where MFA becomes Block: integrations, the API, screens where no person can answer.
- Who receives the notifications, and what they do next.
- How long the policy runs in notify-only before anything is blocked, and who decides it’s ready.
- The way back in when a policy blocks the wrong people.
Beyond the exam: what AI changes. An agent works through the same doors: it queries through the API, runs reports, reads list views. A policy will see the agent’s user, and MFA will become Block, because no person is there to answer. Decide on purpose whether a policy should stop an agent, and test it with the agent’s user before you turn it on. Chapter 20 covers agents.
Explore
Section titled “Explore”- Transaction Security (opens in a new tab), Salesforce Help (checked 2026-11-26)
- Transaction Security Actions and Notifications (opens in a new tab), Salesforce Help (checked 2026-11-26)
- Build a Transaction Security Policy with Condition Builder (opens in a new tab), Salesforce Help (checked 2026-11-26)
- Create a Transaction Security Policy That Uses Apex (opens in a new tab), Salesforce Help (checked 2026-11-26)
- Trust (opens in a new tab), Salesforce Architects, Well-Architected (checked 2026-11-26)
- For logins: Transaction Security at the Door, Securing Salesforce: Identity and Access
