I have two profiles named as Recruiter and Manager,for these two objects, i am overwriting standard new button with custom Visual force page

I need for one profile custom Vf page for New button and another profile for No Override(use default) functionality for New Button

How to Restrict Profile Based access for Overriding Functionality in salesforce?

1 Answer 1


You can use the action attribute on the VF page to call a function in your controller that redirects users that should not use the override to the default New-screen. You can use the nooverride GET parameter to prevent the action override.

Your function could look something like this:

public PageReference redirect(){
    PageReference pr;
    String currentProfile = someFunctionToGetProfile()
    if(currentProfile == 'Profile That Needs Normal New Page'){
         //replace 000 with the actual object prefix that you need
         pr = new PageReference('/000/e?nooverride=1');
    return pr;
  • we can restrict system administrator profile also @rael_kid
    – SFDC
    Commented Jul 2, 2018 at 9:19
  • Good Suggestion, can you ellaborate the solution with controller also
    – SFDC
    Commented Jul 2, 2018 at 9:20
  • 1
    I'm not sure I understand. You can extend the check currentProfile == 'Profile That Needs Normal New Page' to any number of different profile names. I don't know how to elaborate any further though Commented Jul 2, 2018 at 9:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .