דלגו לתוכן

External Objects and Performance

תוכן זה אינו זמין עדיין בשפה שלך.

Module 5 of 7 in the chapter Taking Access Away: Restriction and Scoping Rules, chapter 16 of Securing Salesforce: Sharing and Visibility. Each module stands on its own.

The question this module answers: A restriction rule runs every time a user looks. On an external object, or on an object with millions of records, how do you make sure that’s safe and fast?

Every rule in this chapter is a filter that runs whenever the user looks at the object. On a small custom object, nobody notices. On an object whose rows live in another system, or one with tens of millions of rows, the filter is part of every list view, lookup and report. This module is about those two cases.

External objects: the only lock on the row

Section titled “External objects: the only lock on the row”

When I first showed restriction rules, this is the part I was most excited about. We didn’t used to have record-level security on external objects. Now we do.

Here’s why it matters. An external object’s rows live in another system, read through Salesforce Connect. There’s no share table for them and no sharing rules. And even a restriction rule doesn’t bring the sharing model along: “Restriction rules for external objects don’t include organization-wide defaults or sharing mechanisms” (Restriction Rules (opens in a new tab), Restriction Rules Developer Guide, checked 2026-11-26). So inside Salesforce, the restriction rule is the only thing deciding which rows a user sees. Everything else is the object permission, and whose credentials the connection uses in the other system.

Chapter 12, module 8 walks through those other locks, the identity type and the named principal, and the fine print: only the OData 2.0, OData 4.0 and Cross-Org adapters support restriction rules, the custom adapter doesn’t, external IDs can’t be used in the record criteria, and edits and searches can mean extra calls the other system bills for. Read it with this module. Here I’ll add what you need to design and run the rule.

When a rule filters an external object, the other system does part of the work. Salesforce is plain about whose job that is: “External object record data is stored outside Salesforce. Admins are responsible for ensuring that rules they create on external objects don’t negatively impact performance in Salesforce or in the external system” (Restriction Rule Considerations (opens in a new tab), Salesforce Help, checked 2026-11-26).

Say a distributor’s shipments live in its warehouse system, shown in Salesforce as an external object, and each sales region should see only its own region’s shipments. The rule’s record criteria, region equals the user’s region, applies every time Salesforce asks the warehouse system for shipments, and Salesforce’s own words put part of that load on the other system. If the warehouse system can’t filter by region quickly, every list view in Salesforce is slow, and the warehouse team will hear about it before you do. Ask the other system’s owners before you write the rule: is that field indexed on their side, and how many calls a day can they take?

Search is where external objects behave most differently:

  • The Cross-Org adapter. “External objects created using the Cross-Org adapter don’t support search or SOSL when a rule is applied to a user. Salesforce returns only search results that match the most recently viewed records” (Restriction Rule Considerations).
  • Every search is a call. “When search is enabled for external object records, searching requires additional database calls each time. Avoid additional charges by turning off search for external object records” (same page).

So decide on purpose whether users search an external object at all. Salesforce’s advice, and mine in the video, is to turn search off unless you need it.

One practical thing too: “External objects don’t appear in Object Manager. To navigate to an external object, enter External Data Sources in the Quick Find box in Setup, then select External Data Sources” (same page). That’s where its restriction rules are.

Large objects in Salesforce: test the filter

Section titled “Large objects in Salesforce: test the filter”

For objects inside Salesforce, Salesforce built restriction rules to keep up: “Restriction rules were built to support sharing needs in a performant way. Your data volume and architecture are also factors in rule performance” (Restriction Rule Considerations).

And it gives you a test you can run before the rule goes live (same page):

  1. Run the filter as a query. “To test a rule’s performance impact, take the record criteria to your API client of choice and run the query. If it’s fast for a given user, the rule is likely to run efficiently.”
  2. Allow for the extra work. “For objects with large data volumes, add three to five percent overhead to the record filter’s performance.”
  3. Fix the slow field. “If it isn’t performant, isolate the field that is slowing performance. Work with Salesforce customer support to get the field indexed.”

“Fast for a given user” means one of the users the rule applies to, not you as an admin. Run it as the user who’ll see the most records, and as the one who’ll see the fewest.

The same advice applies everywhere in this course: “using only object fields that are indexed is recommended, especially in record criteria” (same page). If the field your rule tests is a computed one from module 2, filled by automation, ask for it to be indexed before the object grows, not after the first slow list view. Why a filter on an indexed field is fast, and when an index helps, is the subject of the Data Architect course’s chapter on query and retrieval architecture.

Search is the one place in this chapter where a user can have access to a record and still not see it. It helps to know why before the first ticket arrives, because it looks exactly like a broken rule.

A list view, a related list, a report: each of those reads the object with a query, SOQL, and the user’s access is part of the query. The rule filters as Salesforce reads the records. Search works in a different order. Global search, and SOSL in code (FIND), first ask the search index for records that match the term, and the index has limits. Salesforce lays out the steps: “The search engine looks for matches to the search term across a maximum of 2,000 records.” A search on one object returns up to 250 of them by default; a search across many objects splits the 2,000 between them. And only after that: “For all other users, SOSL applies user permission filters. Individual users see only those records that they have access to” (SOSL Limits on Search Results (opens in a new tab), SOQL and SOSL Reference, checked 2026-11-26). Admins with View All Data see the full set.

Read that order again. The limit comes first and the access filter second. If many records match the term, and most of them are records this user can’t see, the ones they can see may never make it into the limited set. That’s search crowding. Salesforce names it in the restriction rule considerations: “A user with a restriction rule applied might not find all possible matching results when searching for a record.” Search limits the number of results for performance, and the record can fall outside them (Restriction Rule Considerations).

So a restriction rule doesn’t cause search crowding. Any user with narrow access can hit it, through sharing alone. A rule makes it more likely, because the narrower the user’s slice of the data, the more of those candidates are records they’ll never see. A rule that leaves each user one region out of fifty is exactly that case.

When a user with a rule says “I searched and it wasn’t there,” ask whether they can open the record from a list view. If they can, it’s search crowding, not the rule. Salesforce’s advice is a more specific search term (in its example, a company name and city instead of one common word), and searching one object instead of all of them, so the limit applies to that object alone (same SOSL page). Check that before you open a sharing investigation. The same limits apply to SOSL in Apex, so code that must find every matching record the user can see uses a query, not a search.

Keeping a restriction rule safe and fast Keeping a restriction rule safe and fast. On an external object, with its rows in another system: the rule is the only record-level lock in Salesforce; only the OData 2.0, OData 4.0 and Cross-Org adapters support it; the filter loads the other system too; turn search off unless you need it. On a large Salesforce object, with millions of rows: run the record criteria as a query, as a user the rule applies to; add three to five percent for large volumes; index the field the rule tests. Footnote: a restriction rule runs every time the user looks, so test the filter before the rule goes live. {"author": "Steve Simpson", "blueprint": "1.1.0", "builder": "standard 1.59.0", "built": "2026-11-21", "id": "DGM-SVA-RR-05", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "comparison 0.5.0", "theme": "stevetecharc 1.4.0"} On an external object rows in another system The only record-level lock in Salesforce OData 2.0, OData 4.0 and Cross-Org only The filter loads the other system too Search off unless you need it On a large Salesforce object millions of rows Run the record criteria as a query, as the user Add three to five percent for large volumes Index the field the rule tests A restriction rule runs every time the user looks: test the filter before the rule goes live. © 2026 Twinshark LLC · stevetecharc.com
Click to enlarge

Test knowledge. Know that restriction rules work on external objects only through the Salesforce Connect OData 2.0, OData 4.0 and Cross-Org adapters, that they don’t include org-wide defaults or sharing mechanisms there, that Cross-Org external objects don’t support search or SOSL when a rule applies, that searching and editing rules can mean extra billed calls, and that disabling search is recommended. Know the performance test: run the record criteria as a query, add three to five percent overhead for large data volumes, and ask Salesforce Customer Support to index a slow field. Know search crowding: SOSL and global search limit the matching records first (up to 2,000) and apply the user’s access after, so a user with narrow access, from sharing or a rule, can miss a record they can open from a list view; a query (SOQL) doesn’t have this effect; a more specific term or a single-object search helps. A likely area, not a known question.

  • For each external object, whether a restriction rule is the only lock in Salesforce, and whether the adapter supports one.
  • With the other system’s owners: whether the rule’s field is indexed on their side, and how many calls they can take.
  • Whether users search the external object at all, and if not, that search is off.
  • For large Salesforce objects: the performance test as the users the rule applies to, and the field indexed before the volume arrives.
  • What support tells users who can’t find a record by search but can open it, and that code needing every visible match uses a query, not SOSL.

Beyond the exam: what AI changes. Agents search and query far more often than people do. On an external object, every one of those requests is a call to the other system, filtered by your rule, and maybe a billed one. Before an agent reads an external object, ask whether it needs to, count the calls it might make in a busy hour, and agree on that with the other system’s owners. Chapter 20 covers agents.