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
Pavan Kumar 722Pavan Kumar 722 

View Button override - Redirect to a VF page or standard detail page based on Recordtype using URLFOR on page action method

I need to restrict View button override based on Record type of Opportunity using page action method using URLFOR function. Based on the record type, I need to rediredt the page to standard detail page or another vfpage. I tried few things, but I can't get this thing working. Somehow i cannot get it to redirect it to standard detail page, what am I doing wrong here?.
 
<apex:page standardController="Opportunity"  action="{!URLFOR(CASE(Opportunity.RecordType.Name, 'RecType1',  '/apex/vfpage1', 'RecType2', 'apex/vfpage1', 'RecType3', $Action.Opportunity.View, '/apex/vfpage1'), Opportunity.Id) }">
     <apex:variable value="{!Order__c.RecordType.Name}" var="recTypeName"/>-
</apex:page>
I used the below references:

http://salesforce.stackexchange.com/questions/33192/how-to-override-edit-button-for-custom-visualforce-page-based-on-recordid/33193#33193
https://salesforce.stackexchange.com/questions/63203/override-standard-edit-button-based-on-recordtype/63252
 
NagendraNagendra (Salesforce Developers) 
Hi Pavan,

May I request you to please post the code snippet of what you have done so far so that we can look into it and can help you accordingly.

Thanks,
Nagendra.
Pavan Kumar 722Pavan Kumar 722
@Nagendra: I have already posted my code in question description.