function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JJE_OLDJJE_OLD 

Overriding Page by Profile

Hi,

 

I have several page layout for Contact and wanted to override some of them with a Visualforce page.

Is there a way to do this by profile (like we can select the profile page layout) or should we manage all the displayed differences in our code?

 

Thanks,

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

You can't override in quite that way, as the override applies everywhere.

 

What you can do, however, is have a visualforce override that determines where the user should end up based on their profile.  Thus certain profiles can be sent to the standard pages, while others can be sent to different visualforce pages. 

 

There's a cookbook recipe for this at:

 

http://developer.force.com/cookbook/recipe/overriding-a-page-for-some-but-not-all-users

All Answers

bob_buzzardbob_buzzard

You can't override in quite that way, as the override applies everywhere.

 

What you can do, however, is have a visualforce override that determines where the user should end up based on their profile.  Thus certain profiles can be sent to the standard pages, while others can be sent to different visualforce pages. 

 

There's a cookbook recipe for this at:

 

http://developer.force.com/cookbook/recipe/overriding-a-page-for-some-but-not-all-users

This was selected as the best answer
JJE_OLDJJE_OLD

Hi,

 

I tried this based on the cookbook link:

<apex:page action="{!if($Profile.Name == 'My Profile', null, urlFor($Action.Contact.View,$CurrentPage.parameters.id,null,true))}" standardController="Contact" >

 And that seems to work. I will now have to write a class to manage all my cases.

 

Thank you very much for the clue.