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
BuellBuell 

Conditional Tabbed Objects

I have created tabbed pages with accounts, leads, contacts etc and would like to give users the option to either use these new visualforce pages or stick with the standard layouts.  Looking through the force.com cookbook I came across the following:

 

 

<apex:page action= "{!if($Profile.Name !='System Administrator', null, urlFor($Action.Account.Tab, $ObjectType.Account, null, true))}" ... >

 

 

Rather than making it conditional on ones profile I'd like to make it conditional on a custom field on the user record called 'Tabbed_Objects__c'.  Can anyone help me modify the above to show the standard account or tabbed account based on this checkbox?  

 

Thanks in advance!

Best Answer chosen by Admin (Salesforce Developers) 
wesnoltewesnolte

Hey

 

You would need to pass the ID of the tabbed_objects__c and Account to the page and you would have to change the page thus

 

 

<apex:page standardController="Tabbed_objects__c" action= "{!if($Tabbed_objects__c.pageToUse__c !='standard', urlfor($Page.MyAccountPage), urlFor($Action.Account.Tab, $ObjectType.Account, null, true))}" ... >

 

This may not be exactly what you need but it should get you started.

 

Cheers,

Wes 

 

All Answers

wesnoltewesnolte

Hey

 

You would need to pass the ID of the tabbed_objects__c and Account to the page and you would have to change the page thus

 

 

<apex:page standardController="Tabbed_objects__c" action= "{!if($Tabbed_objects__c.pageToUse__c !='standard', urlfor($Page.MyAccountPage), urlFor($Action.Account.Tab, $ObjectType.Account, null, true))}" ... >

 

This may not be exactly what you need but it should get you started.

 

Cheers,

Wes 

 

This was selected as the best answer
BuellBuell

Thanks for the help.  I still need to change this part:

 

 

urlFor($Action.Opportunity.Tab, $ObjectType.Opportunity, null, true)

 

 to redirect to the standard opportunity layout.  For example, if the user does not have tabbed objects enabled, then when they select an opportunity record rather than loading the tabbed visualforce page they will see the standard opportunity page.

 

BuellBuell

By the way, this was the solution:

 

 

action="{!if($User.Tabbed_Layouts__c, null, urlFor($Action.Opportunity.View, Opportunity.Id, null, true))}"