We have a customer portal which has sharing set by Account i.e. Record level security by granting access to portal users where their Account matches the Account associated with the record.

I was under impression that , SF adds filter for account to any SOQL query from custom portal which has account sharing set i.e. it adds filter ( AND Account__c = '001xxxxxxx' ) to any query from customer portal based on account of the logged in user.

When I login as portal user and look at debug logs for SOQL query being executed I don't see any filter added ( AND Account__c = '001xxxxxxx' ) .

Does this mean any SOQL query fired from customer portal with sharing set as account may not be selective ? e.g. a query on custom object,

 select Name from MyCustObj__c where Status__c= 'Approved' 

will not be selective if there is no custom index on Status__c field ?

Any insight on this would be very helpful.

1 Answer 1


SF doesn't know in advance what your sharing model for your portal is going to be. If you're running this query from a controller or other code, then it's your responsibility to make it more selective.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .