1

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

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 Jul 2 '18 at 9:19
  • Good Suggestion, can you ellaborate the solution with controller also – SFDC Jul 2 '18 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 – rael_kid Jul 2 '18 at 9:24

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.