Conditional custom button on page direct to URL if condition is true and display message if false

Conditional custom button on page direct to URL if condition is true and display message if false:


The custom button reference the visualforce page.


<apex:page standardController="yourObj__c" action="{!IF(ISPICKVAL (yourObj__c.Field1__c,'abc'),

                            URLFOR(...xxxxx...),

                            NULL)}"/>

    <apex:pageMessage severity="warning" summary="You cant be redirected...contact admin..."/>

</apex:page>


Use the page action attribute and return null to stay on the page. 



Comments