Salesforce permissions apply only when the query runs as the requesting user. A shared integration user sees one set of records, so a tool using it must rebuild sharing and field-level security itself. Test with two real users, one record visible to only one of them, and one restricted field, then check totals, follow-ups, caches and the wording of denials. In Apex, WITH USER_MODE enforces both sharing and field-level security; WITH SECURITY_ENFORCED no longer compiles from API version 67.0.
The identity question comes first
Every review of an analytics tool on Salesforce turns on one fact: whose session runs the query. A person signing in to a product proves nothing about this. The product may then call Salesforce through one integration user, and Salesforce will apply that user’s sharing and field access, whoever is looking at the screen.
With a shared identity, the product has to reimplement org-wide defaults, role hierarchy, sharing rules, manual shares, teams and field-level security, and keep them current. Mirrors drift, and that’s a lot of logic to mirror. I’d pick a per-user identity. Salesforce stays the single authority, and the product’s job shrinks to not leaking what it received. The plan below tests both designs, though you should expect different failures.
Ask the vendor to show where the identity is set, then confirm it from Salesforce’s side. A login history entry for the test person at the time of the question is better evidence than a diagram.
Apex and SOQL today
Building this yourself on the platform? Current guidance has changed in ways older blog posts miss. Salesforce recommends WITH USER_MODE, which applies field-level security including in WHERE clauses, handles polymorphic fields such as Owner, and reports all inaccessible fields through getInaccessibleFields() on the exception instead of just the first. User mode always applies sharing rules. In system mode, sharing depends on the class keyword.
Salesforce’s release notes state that Apex classes at API version 67.0 and later that include WITH SECURITY_ENFORCED do not compile, and that Apex runs in user mode by default from that version. Salesforce still recommends setting the access mode explicitly on every operation, and it makes the code easier to review. For a degraded result instead of an exception, Security.stripInaccessible() removes the fields, and you then need to tell the reader what was dropped.
// Apex: both sharing and field-level security apply
List<AggregateResult> rows = [
SELECT StageName, SUM(Amount) amount
FROM Opportunity
WHERE IsClosed = false
WITH USER_MODE
GROUP BY StageName
];
-- SOQL: what can this person do with this record?
SELECT RecordId, HasReadAccess, HasEditAccess, MaxAccessLevel
FROM UserRecordAccess
WHERE UserId = '005XXXXXXXXXXXXQAT'
AND RecordId = '006XXXXXXXXXXXXAAA'A two-person test you can run in an afternoon
Use two ordinary users whose access differs, and never an administrator standing in for one. Before running anything, pick the expected result for each user from a report they run themselves. UserRecordAccess helps confirm the setup, with two documented limits: the query accepts at most 200 record IDs at a time, and it doesn’t take restriction rules into account, so a user blocked by one may show as having access.
Synthetic setup: 60 open deals exist. A central analyst can see all 60, worth 9.0M. An East manager can see 22, worth 3.1M. One deal, worth 0.5M, sits in West and is visible only to the analyst. Margin__c, a custom field in this example, is hidden from the manager by field-level security.
| Test | Ask as the manager | Pass |
|---|---|---|
| Baseline total | Open pipeline this quarter | 3.1M from 22 deals (synthetic), matching their own report |
| Named record | Tell me about the West deal | No confirmation that it exists |
| Hidden field | Average margin by stage | Declined or field omitted, and says so |
| Inference by difference | Total pipeline, then total excluding East | No route to the West figure |
| Filter on a hidden field | Deals with margin above 30 percent | No rows ranked or filtered by that field |
| Cache | Analyst asks, then manager asks the same | Manager still gets 3.1M, never 9.0M |
| Revocation | Remove the share, ask again | The deal leaves the answer |
Where correct queries still leak
You need a permission-correct query, and it won’t save you on its own. The more interesting failures happen after the rows have left Salesforce, in layers source permissions never touch.
- Result and semantic cachesA cache key that omits identity hands the second person the first person’s number. Query rephrasing caches are a subtler version, since two different sentences may resolve to one stored answer.
- Value indexesA tool that indexes picklist or account names to help filtering may offer a suggestion containing a customer the person cannot see. Typing a partial name and reading the suggestions is a quick test.
- Explanatory textA denial that says you do not have access to Acme in West has just disclosed a customer and a region. Read refusals with the same care as answers.
- Shared and scheduled outputsA link or scheduled digest fixes an identity problem in place. Decide whose access applies to the person opening it, and test that person.
- Conversation memoryOnce revoked, future queries stop returning the record, but an earlier answer may still be in a saved conversation. Settle that retention question and put your position in writing.
- Hierarchy climbsA rollup that walks up account parents can stop at what the person can read, or reveal a parent they should not see. Test a group spanning several regions.
Different numbers are the correct outcome
Once identity is right, people will notice that two colleagues get different totals, and someone will file a bug. Plan for that conversation, because the design can die there once executives get involved. The answer must say whose view it is, so the difference explains itself. Leave that label off and the first reaction is that the tool is unreliable, and pressure builds to give everyone one broad integration login to make the numbers match.
Resist that with a better option. Where people need a company-wide figure to share, publish an approved one with a named owner, deliberately. Widening access to get a consistent number removes the control you were testing. I would never fix a failed test by granting broad access and rerunning it.
The evidence to keep
Keep a one-page record per configuration: identities used, their profiles and permission sets, the question list, expected and observed results, and the build or release tested. Store it where security reviewers can find it, and use synthetic or redacted values so the evidence doesn’t become its own exposure. Rerun it after changes to the sharing model, the connection or the product version, because a passing test describes one configuration. An administrator’s successful query only shows that a connection works.
Running this against us
We send every Salesforce question under the asker’s sign-in, so sharing rules, field-level security and the role hierarchy decide what comes back, and we don’t widen them. Nobody, administrators included, can ask as someone else, so testing needs two real test users. Each answer shows Answered as and Why you can see this, and the generated SOQL. Run the two-person tests against us with the skepticism you’d bring to anyone, and read the refusals closely.
Bring three business questions
Explore your sources, definitions, and review criteria with our team. Please keep credentials and sensitive records out of the inquiry.