function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
WizradWizrad 

Query Too Complicated & Sharing

Hi all,

 

I have a query, and while it is quite long, it excutes fine under one profile and gives the "Query Too Complicated" error on another profile.

 

AFAIK, the only differences between the two profiles is that one user has "Modify All" on the object being queried, and one user has records shared with them.

 

Does sharing play a role in "query complication"?

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

Yes, View All Data or Modify All Data bypasses some security checks, thus making the query far simpler than for a user without these permissions. You'll have to give at least View All Data permission, or simplify the query, possibly breaking it into multiple passes, if necessary.