I have a custom object with two record types. I've written a Visualforce page to override the Clone button on the object. However I only really want to override for one record type (PCS). My solution was to use the action
attribute in the apex:page
tag, with a boolean which is set to true if the record type is PCS and false otherwise.
When I manually typed out the URL with the id
param set, I got the page to behave as I would like. However after testing this, I overrode the Clone button with the VF page. When accessed from the Clone button it still works fine for PCS record types, but for other record types the page is stuck in some loop where the CONFIRMATIONTOKEN
param keeps changing but no page is loaded. I'm using Chrome 57 if it makes a difference.
Here is a portion of the VF page:
<apex:page standardController="Consumable_Analysis__c" extensions="AnalysisClonerHelper" action="{!IF(pcs,null,URLFOR($Action.Consumable_Analysis__c.Clone,Id,[retURL=Id]))}" >
... //the rest of the page
</apex:page>