I need to restrict View button override based on Record type of Opportunity using page URLFOR function on page action method. Based on the record type, I need to redirect the page to standard detail page or another vf page. I tried few things, but I can't get this thing working.

<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"/>-

I used the below references:

How to Override Edit button for Custom Visualforce page based on RecordID

override standard edit button based on recordtype

  • Do you have any code to share with your question – Santanu Boral Apr 6 '17 at 6:18
  • <apex:page standardController="Opportunity" action="{!URLFOR(CASE(Opportunity.RecordType.Name, 'RecType1', '/apex/vfpage1', 'RecType2', 'apex/vfpage1', 'RecType3', $Action.Opportunity.View, '/apex/vfpage1'), Opportunity.Id) }"> – Pavan Renjal Apr 6 '17 at 6:21
  • Hi Santanu, I have just added the code. – Pavan Renjal Apr 6 '17 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.