1

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>

1 Answer 1

2

You need to override the override. Pass "true" for the optional fourth parameter:

<apex:page standardController="Consumable_Analysis__c" extensions="AnalysisClonerHelper" 
action="{!IF(pcs,null,URLFOR($Action.Consumable_Analysis__c.Clone,Id,[retURL=Id],true))}" >
2
  • Perfect, thank you! What is this doing exactly? Is it because $Action.Consumable_Analysis__c.Clone is calling the VF page now that I've overridden it?
    – Josh D
    Commented May 2, 2017 at 13:53
  • 1
    @JoshD Yes, the infinite loop was because of a redirect on the standard clone action, so the fourth parameter tells salesforce to override the override (thus, perform the default behavior).
    – sfdcfox
    Commented May 2, 2017 at 14:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .