TransWikia.com

Conditional Override of 'New' Button

Salesforce Asked on December 17, 2021

I want to display the standard Salesforce page after clicking on ‘New’ button for some conditions and for others I want to override the ‘New’ button with a VF page. I am not really sure what should be the correct approach to solve this tricky situation.
Any suggestions will be really appreciated.

One Answer

Here is a VF solution expanding on Mark's comment. The fourth argument to URLFOR is nooverride

<!-- Display markup when running user is Switzerland, otherwise, use standard page -->
<apex:page standardController="Foo__c" 
       action="{!IF($User.Country__c = 'CH',
                    NULL, 
                    URLFOR($Action.Foo__c.New,null,null,true)
                   )}"

   <apex:form>
     <!-- my override markup goes here -->
   </apex:form>
</apex:page>

Answered by cropredy on December 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP