+ Start a Discussion
sachin kadian 5sachin kadian 5 

Standard Way to override view button

HI,
I want to override view button(Standard detail page) for certain profiles but not for all. What is the standard way to override? I am thinking to use nooverride=1 but not sure if it is a URL hack or standard way. Any help would be appreciated.

Thanks,
Best Answer chosen by sachin kadian 5

All Answers

CloudGeekCloudGeek
Hello Sachin,

For your Scenario , I would suggest below idea :

1. Create Hierarchy Custom Setting with a Custom Field of Type CheckBox (isCustomViewApplicable__c)  , Default Value = Unchecked , Save it
2. Now, go to the above created Custom Setting, Click on Manage
3. Here , you see, 2 - new buttons, like below :

User-added image

Create Custom Field:

User-added image


Click on Manage,

User-added image

Here you will get to see 2-new buttons, CLICK on the Down-New button below the A|B|CD filters to create records as shown below:

User-added image
Enter the profile you want to provide access for CUSTOM VIEW redirection and CHECK that CheckBox.

Now you can create as many no# of records you want for different profiles :

after that, you will see #of entries created like shown below:
User-added image


Override View Button on your object, redirect it to your VF page (URL)

In your controller for the above VF page, get the Hierarchy Custom Setting created above and do the validation based on that CheckBox created in settings.

If the Logged In User's Profile matching with the any of profiles in Hierarchy Custom Setting has this checkbox enabled ? Redirect them to VF page you created Else to the Standard View Page (SF URL i.e /RecordId)

Hope that helps!


Note: Mark this as solution if this helps!  


 
sachin kadian 5sachin kadian 5
Hey CloudGeek,

Your answer make sense. But my doubt is in last part only.If i will override the "View" button, and a user comes for which i want to show the standard view page(SF URL i.e /RecordId ) how should i do this? because "view" button is override, if I will redirect it to  /RecordId, it will again come on same page  and it will create a infinite for loop. So one option is i will use "/RecordId?nooverride=1" but I am not sure if this is a standard way to do this. So i just wanted to know, is there any other way to redirect the user from overridden page to standard page.
CloudGeekCloudGeek
This was selected as the best answer
sachin kadian 5sachin kadian 5
Thanks a lot CloudGeek. http://developer.force.com/cookbook/recipe/overriding-a-page-for-some-but-not-all-users I am using this. i was just missing a parameter before.