Recipes by Category
App Distribution (2)
Bundle logic, interface and services for distribution.
App Logic (37)
The Apex programming language, workflow and formulas for logic.
Collaboration (6)
The Salesforce Chatter collaboration platform.
Database (29)
Data persistence, reporting and analytics.
Integration (33)
Web Service APIs and toolkits for integration.
Security (9)
Platform, application and data security.
Tools (4)
Force.com tooling
User Interface (36)
Visualforce MVC and metadata-drive user interfaces.
Web Sites (12)
Public web sites and apps with optional user registration and login.
Cookbook Home » Overriding a Page for Some, but not All, Users
Share
X
Vote to Verify a Recipe
Verifying a recipe is a way to give feedback to others and broaden your own understanding of the capabilities on Force.com. When you verify a recipe, please make sure the code runs, and the functionality solves the articulated problem as expected.
Please make sure:- All the necessary pieces are mentioned
- You have tested the recipe in practice
- Have sent any suggestions for improvements to the author
Please Log in to verify a recipe
You have voted to verify this recipe.
© Copyright 2000-2013 salesforce.com, inc. Web-based Customer Relationship Management (CRM) Software-as-a-Service (SaaS).
All rights reserved Various trademarks held by their respective owners.
All rights reserved Various trademarks held by their respective owners.
Salesforce.com, inc. The Landmark @ One Market, Suite 300, San Francisco, CA, 94105, United States
General Enquiries: 415-901-7000 | Fax: 415-901-7040 | Sales: 1-800-no-software
General Enquiries: 415-901-7000 | Fax: 415-901-7040 | Sales: 1-800-no-software

Recipe Activity - Please Log in to write a comment
I tried the same code in my developer's edition, for one page i have given System Admin security setting and for another page i have used Marketing user. When i log in as marketing user I am getting error as Insufficient privileges for accessing the page.
Please let me know what was the issue.
Tested this recipe and worked flawlessly!
Great catch Mans af Klercker! I also noticed another circumstance where this would fail, even in an English org. Salesforce allows you to create a custom profile with the same name of System Administrator. Did you ever figure out a way to have it be Profile Name agnostic?
I think this recipe should be modified to put the redirection logic outside of the content itself. This creates more flexibility for adding more custom pages later and separates the redirection logic into its own.
For example: PageDirectorController that contains the redirection logic, and a single simple page called PageDirector that calls the logic.
Now that this is fixed, it works fairly well, although it is a bit clumsy when you need to replace an edit page. If you use the Action/URLFOR method, the page you are redirected to will not maintain the record variables in the edit page and the cancel button won't return you to the object list page (it just reloads the same page).
The controller extension method works much better, but you have to rebuild the standard page and when you need to make an Edit page, there is no single line equivalent to the <apex:detail /> for a form.
I'm wondering if this recipe works if the user running the code has SF localized to another language? I have had test code that looks up a Profile from Name = 'System Administrator' that runs fine when it's run as a user with english language, but failed when runing as a user with different localization (swedish for example, where the name of this profile is 'Systemadministratör'). I would be very interested in how to look up a certain profile in a language-neutral way
egranger05182009, thanks for reporting this. It looks like the recipe was incorrectly transferred to the system. It's been repaired now.
I'm having trouble with this recipie. First of all, the VisualForce code is the same for all 3 pages which doesn't seem right.
Secondly, when creating the controller extension, I get a compile error: " line 1:30 no viable alternative at character '"' at line 1 column 30" I think the posted code for the extension is wrong. It should start with public class overrideCon{}.... The 5 lines posted there should be in the VF pages calling the controller.