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
Vijay sidaraddiVijay sidaraddi 

Filed is hidden which is accessing my apex class will i get any error if i run my apex class?

Hi 

A user is made a field is hidden if I have to run one apex class which is accessing a same filed which is hidden by other user will my apex class run or will i Get any error ?

Thanks
Vijay S
Best Answer chosen by Vijay sidaraddi
Abhishek BansalAbhishek Bansal
Hi Vijay,

No, in class you will not get any error  but if you are trying to see this field on page layouts or any VF page than this field should be not visible to you.
FLS only effects the visibilty of fileds on page layouts and VF pages.

Thanks,
Abhishek

All Answers

Abhishek BansalAbhishek Bansal
Hi Vijay,

Your apex class will run fine without showing any error.
The error should have come in that case when the user does not have access on that field and your class is also defined as "Public with sharing".

The visiblity of field have effect on page layouts not in apex classes or triggers.
Please let me know if need more clarification on this.

Thanks,
Abhishek.
Vijay sidaraddiVijay sidaraddi
Hi Abhi

Confirm on below doubt
for example : 
if suppose you are making field as hidden(Using FLS- field level security ) i mean you are making field as Private which is made by you  in case i dont have access for the field which is hidden,will i get error?
Thanks
Vijay S 
Abhishek BansalAbhishek Bansal
Hi Vijay,

No, in class you will not get any error  but if you are trying to see this field on page layouts or any VF page than this field should be not visible to you.
FLS only effects the visibilty of fileds on page layouts and VF pages.

Thanks,
Abhishek
This was selected as the best answer
Vijay sidaraddiVijay sidaraddi
thanks lot