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

hidden fields breaking my code

im wondering how people get around selecting fields for any specific object.  currently i have hard coded what fields i query from the api, the problem im facing is that when one of those hard coded fields are set to hidden for a specific user i get no response at all from the api. is there anyway around this except for asking all my clients to make every field visible that is needed.

Best Answer chosen by Admin (Salesforce Developers) 

You can use a Describe call to verify the presence of a field. Note that a field need not be VISIBLE, but simply ACCESSIBLE for the user. This rule is not true in Professional Edition, however, as visibility is required for accessibility (it silently modifies the accessibility as a feature of adding/removing from the layout). Generally, I would advise that you use Apex Code when practical (Apex Code is not hindered by accessibility), or advise that the fields must be accessible to all users (under Set Field Level Security, not the page layout).