Join our Newsletter — 33% off our NHI Course
Home› Guides› Salesforce Transaction Security Policies: Blocking Mass Exports and…
Guide SaaS & OAuth Integrations

Salesforce Transaction Security Policies: Blocking Mass Exports and Risky Sessions in Real Time

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 13 min read
On this page

Most Salesforce data theft is visible in the logs only after the export file has already left the org, so detection alone arrives too late. Transaction Security Policies evaluate Real-Time Event Monitoring events as they happen and can block the operation, demand multi-factor authentication or notify the security team before the data moves. This guide covers how policies work, which events and fields matter, how to choose between Condition Builder and Apex, and how to roll policies out without locking out administrators or breaking integrations. It is written for Salesforce administrators and SaaS security engineers who already collect Salesforce events and now want enforcement.

This is an independent guide from NHI Mgmt Group, based on Salesforce's public documentation as of November 2026. It is not sponsored or reviewed by Salesforce. Product features change, so confirm settings against Salesforce's current documentation.

Key takeaways

  • Policies act in the transaction, not after it. A policy watches one event type and can block, require MFA or notify, which turns an export alert into an export that never completes.
  • Action support differs by event. MFA is available only on LoginEvent, ReportEvent and ListViewEvent for UI sessions, while anomaly and threat detection events support notifications only.
  • Condition Builder first, Apex when logic branches. Condition Builder covers simple thresholds on a subset of fields; Apex implements TxnSecurity.EventCondition and can use any event field, query data and apply exceptions.
  • Start in notify mode and read PolicyOutcome. Every evaluated event records PolicyOutcome and EvaluationTime, which gives you a tuning baseline before you switch to block.
  • A bad LoginEvent block policy can lock you out. Build and test in a sandbox, keep a break-glass administrator path and treat the Exempt from Transaction Security permission as a privileged entitlement.

What Transaction Security Policies do

A Transaction Security policy combines three things: the event to watch, the condition that makes the event a problem, and the real-time action plus optional notifications. Salesforce describes the feature as monitoring Salesforce events in real time against rules you define. It sits on top of Real-Time Event Monitoring: each monitored activity produces a streaming platform event with a matching storage object, and the policy engine evaluates the event before the user's operation completes.

  • Block: the operation is stopped and the user sees a block message (the default message or your own text, which should tell the user how to get legitimate access).
  • Multi-factor authentication: the user must complete a step-up challenge before the operation continues. It applies to UI logins only, so API clients and integration users cannot satisfy it.
  • Notifications: an email, an in-app notification in the Salesforce app, or both, sent to the recipient you choose. Notification can be paired with block or MFA, or used on its own.
  • No action: the policy evaluates and records the outcome without intervening, which is the right state for tuning.

Availability: Transaction Security requires a Salesforce Shield or Salesforce Event Monitoring add-on subscription and is available in Enterprise, Unlimited and Developer Editions. Creating, editing and removing policies requires the Modify Transaction Security Policies permission. Policies are managed in Setup under Transaction Security Policies; on first use an administrator selects Enable to turn the feature on.

For the wider logging picture (Event Log Files, storage objects, SIEM ingestion and detection content) see the Salesforce Event Monitoring Detection Guide. This page focuses on enforcement.

Event types and policy conditions

The table lists the event types Salesforce Help documents for Transaction Security policies and the actions each supports. The Platform Events Developer Guide also marks some additional streaming events (such as LoginAsEventStream, LoginAnomalyEvent and GuestUserAnomalyEvent) as usable in policies, so check the current developer list for your release before designing around them.

Event typeWhat it representsSupported actionsTypical policy use
ReportEventReport views, runs and exports from Classic, Lightning or APIBlock, Notifications, MFA (UI logins only)Large exports, exports of sensitive objects
ListViewEventList view access from the UI and APIBlock, Notifications, MFA (UI logins only)Bulk viewing of contacts or leads
ApiEventSOQL queries and deletes through the APIsBlock, NotificationsHigh row counts from unapproved clients
BulkApiResultEventStoreDownload of Bulk API job resultsBlock, NotificationsBulk extraction of results files
FileEventFile downloads, previews and related actionsBlock, NotificationsMass document downloads
LoginEventLogin attempts and their contextBlock, Notifications, MFA (UI logins only)Location, browser, platform and session controls
PermissionSetEventStoreAssignment of permission sets carrying sensitive permissionsBlock, NotificationsPrivilege escalation such as View All Data grants
ApiAnomalyEventStoreAnomalous API query behaviour detected by SalesforceNotificationsRoute anomaly to the SOC
ReportAnomalyEventStoreAnomalous report activityNotificationsRoute anomaly to the SOC
CredentialStuffingEventStoreCredential stuffing detected against loginsNotificationsTrigger password and MFA review
SessionHijackingEventStoreSession hijacking indicatorsNotificationsTrigger session revocation runbook

Two behaviours are easy to miss. First, MFA on ListViewEvent is not supported for list views in Lightning pages, so Salesforce upgrades the MFA action to Block there. Second, stream-only events such as LogoutEventStream, UriEventStream and LightningUriEventStream cannot be policy targets.

Fields that conditions usually key on

FieldEventsWhy it matters
RowsProcessedReportEvent, ApiEventTotal rows returned; the core volume threshold for export policies
OperationReportEvent, ApiEventReportEvent values include ReportExported, ReportExportedAsynchronously and ReportExportedUsingExcelConnector; ApiEvent values include Query, QueryAll, QueryMore, DeleteSoft and DeleteHard
QueriedEntitiesReportEvent, ApiEventObjects touched, including related entities, so a policy can focus on Contact, Lead or custom sensitive objects
SessionLevelReportEvent, ApiEvent, othersHIGH_ASSURANCE, STANDARD or LOW; lets you allow large exports only from high-assurance sessions
Client, ApiType, ConnectedAppIdApiEventWhich client and API (Bulk, REST, SOAP) made the call; ConnectedAppId is populated during OAuth authentication and null when an active token is reused
SourceIpMost eventsOrigin address for network-based conditions
ExportFileFormatReportEventCSV or Excel for exported reports
PolicyId, PolicyOutcome, EvaluationTimePolicy-enabled eventsWhich policy fired, what happened and how long evaluation took; populated after all policies are processed

The ApiEvent Client field reports MCP servers as "agentic-api-service", which is useful for scoping policies to AI agent traffic separately from human and classic integration traffic.

Condition Builder or Apex

NeedCondition BuilderApex policy
Simple threshold (rows, operation, entity)Yes, no codePossible, but unnecessary
Fields availableA subset of each event's fieldsAny field on the event
Exceptions by profile, role or groupLimited to fields on the eventQuery related data, for example the user's profile
Branching, loops, several event types in one classNot supportedSupported through a switch on the SObject type
Change controlSetup change, easy to reviewCode with test classes, deployed through your release pipeline

An Apex policy class implements the TxnSecurity.EventCondition interface and its single method, evaluate(SObject event), which returns true when the policy should trigger. The system, not the method, performs the action and sends notifications. When you create an Apex policy from Setup, Salesforce generates an empty class named after the policy (without spaces) with "EventCondition" appended. Salesforce's own example blocks report views or exports above a row count unless the user's profile is Data Steward, which is exactly the kind of exception Condition Builder cannot express. Keep evaluation logic short: it runs inside the user's transaction, and EvaluationTime shows the cost. Test classes are required before the class can reach production.

Blocking mass exports

Export controls give the clearest return. Salesforce provides a default ReportEvent policy that monitors large report exports and enforces MFA; review it before writing your own so the two do not overlap.

  1. Report exports: ReportEvent where Operation equals ReportExported (add the asynchronous and Excel connector operations as separate conditions or an Apex check) and RowsProcessed is at or above your threshold. Action: MFA for human users, with notification to security.
  2. Sensitive objects at any size above a lower bar: ReportEvent or ApiEvent where QueriedEntities contains Contact, Lead or your custom regulated objects and RowsProcessed exceeds a smaller threshold. Action: notify first, block once tuned.
  3. API extraction from unapproved clients: ApiEvent with a high RowsProcessed where Client or ConnectedAppId is not on your approved integration list. This needs Apex if the allow-list lives in a custom metadata type. Action: block and notify.
  4. Bulk API results downloads: BulkApiResultEventStore for integration users outside their expected pattern. Action: notify, then block once each integration's baseline is documented.
  5. List view scraping: ListViewEvent with high row counts on contact and lead views. Remember that MFA becomes Block in Lightning list views.
  6. Mass file downloads: FileEvent thresholds for document-heavy orgs, notify first.

Pick thresholds from data, not guesses: query the storage objects (ReportEvent, ApiEvent) for 30 days of RowsProcessed by profile and by integration user, then set the threshold above the legitimate high-water mark. Give every integration its own integration user so that per-integration baselines are possible; see How to review Salesforce connected apps and integration users and Salesforce API Access Control.

Risky session policies

Session policies use LoginEvent and the SessionLevel field on data events to stop stolen or weak sessions from doing high-impact work.

ScenarioEvent and conditionSuggested actionTrade-off
Administrator login from outside approved networks or countriesLoginEvent, user in admin profiles, SourceIp or location outside policyBlockTravel needs a documented exception path
Login from unsupported browser or platformLoginEvent, browser or platform fieldsMFALow friction, raises cost of replayed credentials
Large export from a standard-assurance sessionReportEvent, SessionLevel not HIGH_ASSURANCE, high RowsProcessedMFAUsers step up once per session
Grant of View All Data or Modify All DataPermissionSetEventStoreNotify, block outside change windowsBlocking can stall legitimate change
Session hijacking or credential stuffing detectedSessionHijackingEventStore, CredentialStuffingEventStoreNotifyResponse happens in your runbook, not in the policy

Integration users cannot answer an MFA prompt, so for them the only real-time options are block or notify. Session hijacking alerts should feed the response steps in the Salesforce Org Compromise Playbook.

Testing and rollout

  1. Baseline: collect at least two to four weeks of Real-Time Event Monitoring data and calculate per-profile and per-integration volumes.
  2. Build in a sandbox: create each policy disabled, with the action set to notification only. Salesforce explicitly warns that a LoginEvent policy with Block can lock you out, so never build login block policies first in production.
  3. Protect access: confirm a break-glass administrator who is excluded through Apex logic or the Exempt from Transaction Security permission, store that account under privileged access controls and alert on its use.
  4. Test Apex: write test classes that cover the trigger and non-trigger paths, then deploy through your normal release process.
  5. Notify-only in production: enable the policies with notifications only and review PolicyOutcome daily for false positives.
  6. Promote by risk: move export policies to MFA, then block the clearest cases (for example the largest exports of regulated objects). Change one policy at a time.
  7. Rollback: the Status toggle on the policy's Actions tab disables it immediately. Name an owner for each policy who can turn it off and record why.

Transaction Security uses resource metering. Users assigned the Exempt from Transaction Security permission are excluded from all policies; Salesforce intends this for cases where metering blocks business-critical automation such as bulk API calls. Grant it narrowly, review it in access certifications and watch for MeteringBlock and MeteringNoAction outcomes, which tell you metering rather than your condition decided the result.

Monitoring outcomes

Each policy-enabled event records PolicyId and PolicyOutcome. ReportEvent outcomes include Block, Notified, NoAction, ExemptNoAction, Error, MeteringBlock, MeteringNoAction and a set of TwoFA values (TwoFAInitiated, TwoFASucceeded, TwoFADenied, TwoFAFailedInvalidCode and others). Send the storage objects to your SIEM so policy outcomes sit beside identity provider and endpoint data; a policy sees one event at a time, while correlation across sources belongs in the SOC.

  • Block rate per policy: blocks per week, with each block triaged as true or false positive.
  • False positive ratio: share of blocks or MFA prompts that were legitimate work; aim to drive it down before promoting more policies.
  • MFA step-up outcomes: TwoFASucceeded against TwoFADenied and TwoFAFailed values; failures on export policies deserve investigation.
  • Error and metering outcomes: any Error, MeteringBlock or MeteringNoAction outcome is a policy health problem to fix.
  • Evaluation time: EvaluationTime trends per Apex policy, to catch slow logic.
  • Exemption count: number of users with Exempt from Transaction Security, which should stay small and stable.

Framework mapping

FrameworkReferenceHow policies contribute
NIST SP 800-53 Rev 5SI-4 System Monitoring; AC-2(12) Account Monitoring for Atypical Usage; IA-11 Re-authentication; AU-6 Audit Record Review, Analysis, and ReportingReal-time evaluation, volume anomalies, MFA step-up, outcome review
NIST CSF 2.0DE.CM-03; DE.AE-02; PR.AA-05Monitoring personnel and technology usage, analysing events, enforcing access policy
ISO/IEC 27001:2022 Annex AA.8.12 Data leakage prevention; A.8.16 Monitoring activitiesExport blocking and monitored activity
MITRE ATT&CK v20T1213 Data from Information Repositories; T1078.004 Cloud Accounts; T1567 Exfiltration Over Web ServiceBlocking bulk collection from the CRM by valid but misused accounts

Where identity fits

Policies are only as precise as the identities behind the events. Shared integration users blur baselines and force loose thresholds, while one integration user per connected app or external client app lets a policy block one misbehaving integration without disrupting the rest. Treat integration users as non-human identities with owners, scoped permission sets and reviewed tokens; see the Salesforce External Client Apps guide for the app side.

Common failure patterns

  • Login block policy built in production: an over-broad LoginEvent block locks out administrators; build in a sandbox and keep a tested break-glass path.
  • MFA chosen for API traffic: MFA applies to UI logins only, so integrations either fail unpredictably or are never controlled; use block or notify for API events.
  • Policies left in notify mode for good: alerts arrive after the export has finished; set a date to promote each policy once its false positive rate is acceptable.
  • Exemptions as a fix for noise: granting Exempt from Transaction Security to silence alerts removes those users from every policy; tune the condition instead.
  • Only one export path covered: a ReportExported policy alone misses asynchronous exports, the Excel connector, API queries, Bulk API results and list views; cover each path.
  • Unread outcomes: nobody reviews PolicyOutcome, so Error and metering outcomes go unnoticed for months.

Practitioner checklist

  • Confirm Shield or Event Monitoring licensing and enable Transaction Security in a sandbox first.
  • Review the default large report export policy before adding your own export rules.
  • Baseline RowsProcessed per profile and per integration user from 30 days of storage object data.
  • Cover every export path: report exports, list views, ApiEvent queries, Bulk API results and FileEvent.
  • Use Condition Builder for simple thresholds and Apex with test classes for exceptions and allow-lists.
  • Use MFA only for UI sessions; use block or notify for integrations and API clients.
  • Keep a break-glass administrator path and restrict the Exempt from Transaction Security and Modify Transaction Security Policies permissions.
  • Run new policies notify-only, then promote to MFA or block one policy at a time with a named rollback owner.
  • Stream PolicyOutcome and EvaluationTime to the SIEM and report block rate, false positives and error outcomes monthly.

Standards and references

Related NHI Mgmt Group resources: Salesforce Security Guide · Salesforce Event Monitoring Detection Guide · Salesforce API Access Control · Salesforce Shield Platform Encryption · Salesforce Org Compromise Playbook

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.