2

If i dont assign vf page and apex class in permission set... Will the following logic work:- In a vf the page i need some fields to be visible or edited to the user if he is assigned that permission set. As i have not assigned the page and class to permission set.. but the apex class has the logic which checks if the logged in user has permission set. If the user has that permission set we set a boolean flag to true and use that boolean property for rendering of field on page.

2

You could should simplify this process and not "roll your own security" by using the attributes available on the sObject type reference to control visibility of the fields without any code.

For instance, rendering the Contact's email field if the current user has the ability to update that field.

<apex:inputText value="{!contactEmail}" 
    rendered="{!$ObjectType.Contact.fields.Email.Updateable}" />

Here is a great document about mechanisms available for enforcing CRUD and Field Level Security in both code and VF.

https://developer.salesforce.com/page/Enforcing_CRUD_and_FLS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.