I have the following query:

select Id, Name from Product2 where Provider__c = :providerId ORDER BY Name

Provider__c is a lookup field to Account.

Normal users don't get any results, while the admin does, so it seems to be an issue with permissions.

The following query returns all products, also the one I was looking for.

select Id, Name from Product2 ORDER BY Name

The product is accessible to the user, the lookup field is accessible to the user and the account is accessible to the user. What am I missing?

Regards, Stijn

  • 1
    You tried executing same Soql in query editor ?
    Commented Sep 27, 2017 at 13:04

1 Answer 1


The query was correct, the user had created a different account with the same name...but this new account did not have any products linked through the lookup...So the query functioned as expected...Because the name was the same I overlooked the fact that it could be a different Id.

You must log in to answer this question.

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