Thursday, December 8, 2016

Visualforce - Beyond Basics Series 9 - Quick way to check page access

What is page access ?

In salesforce, we can apply security to visualforce pages based on profiles.


How to enforce them in visualforce ?

It's is enforced automatically when user tries the access the restricted page. But, if you want to identify the access before you redirect the user, there's a solution for that.


How to do that ?

Apex profile getContent() method on PageReference class. This applies the profile permissions before returning the content. So, we could use that to determine the access.


Where is the code ?

For illustration, i have given a textbox to accept the page name & then check the access based on that.




No comments:

Post a Comment

Thanks for reading my blog !