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
charles vieillardcharles vieillard 

What SOQL query to get a boolean condition on contacts?

We need to import contacts for sales rep, but if we use the basic soql query, it is much too large.
As a matter of fact the sharing model allow every user to read and write on every contacts in Salesforce's client session. We cannot use the restriction to Read and Write records.
Then we need to restrict the following query.
SELECT '.implode(',', $contactFields).', Account.Name FROM Contact ORDER BY CreatedDate ASC
The right restriction or filter we need would be :
To get all contacts of the accounts where User is Account Owner OR member of the Account salesteam.

Could somebody give a hint on how to build the correct SOQL ? 
Thanks in advance for your HELP.