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
Rohit SharmaGRohit SharmaG 

How to bypass security in VF page

Hi Dears,

I am using custom controller and without sharing keyword in apex class. But when i am trying to use a field of object as apex:inputfield then 
security setting are inforcing on VF page.

Object permission @ profile is read and i want to use that fied on vf page as input field. Please assist on this. Its very urgent.

Thanks,
Rohit Sharma
Hargobind_SinghHargobind_Singh
Hi Rohit,

You can store values in Variables (String, Decimal etc) and use those variables in VF page, and not use the object fields directly. And, not use the with-sharing in class to byepass security.

Though this is not a best-practice, as you might be exposing sensitive data to users who are not supposed to get access, and your SFDC Admin's work will be harder as well, as he/she won't be able to control data security. 

nitesh gadkarinitesh gadkari
Hi Rohit,
I would insist you to mention what settings you have done(permissions).For the time being i can suggest you to do following:-

1.Change profile settings read,edit,create for u to be able to enter.edit data.
2.You can also assign Permission set separately for this.give access to vfpage from the profile's vfpage related list by adding profile users to be able to see the vfpage.
3. Also you can directly do setting given in point 2 by clicking on security link mentioned in front of your page listed in Develop>page

I hope it turns out to be helpful.All the best.

Regards
Nitesh