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
Beth Geshwender 9Beth Geshwender 9 

Why is field level security required for all fields in a query for the query to be successful?

I have a user who is able to view and edit the fields in salesforce via a permission set, however the SOQL query fails unless FLS is enabled, claiming those fields are missing.
Timothy Gentet O'BrienTimothy Gentet O'Brien
If I understand what you mean here... the user is receiving an error as they are trying to query a field they do not have access to?

If so, then of course it will fail, it's almost like you trying to make an omelette without any eggs... you have to have access to it to be able to use it.
Beth Geshwender 9Beth Geshwender 9
Thanks Timothy, I agree, and always thought this was the case, however how would it be possible for the user to read and edit the field when they don't have FLS enabled? Is it possible for permission sets to allow users to edit and access data on a surface level, but the same rules don't apply to SOQL? I'm just looking for a better answer than my own assumption, so I can tell this user they will need to update their secuirty and permissions. 
Timothy Gentet O'BrienTimothy Gentet O'Brien
Hmmmmmm that's an odd one then! Can you double check with this link (https://developer.salesforce.com/docs/atlas.en-us.securityImplGuide.meta/securityImplGuide/users_profiles_fls.htm), just to be safe and ensure that it has all been setup corretcly!

If not reply back and I'll do a little research on my side! It may be worth logging a case with SFDC, just in case there is an underlying issue or something that they can see by accessing your org as well as this post :)