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
ShikibuShikibu 

How to prevent redirect loop when overriding View?

I have a VisualForce page, and want to override Account detail, but only in some circumstances (otherwise default to the standard salesforce view detail page).
 
When I override the "View" button with this VF page, the following code does redirect to the standard page, but it creates an infinite redirect loop.
 
How do I redirect from a VF page to a standard page and prevent the loop? Adding "&sfdc.override=1" to /id in routePage produces "URL no longer exists" error.
 

<apex:page
standardController="Account"
extensions="myAccountControllerExtension"
showHeader="true" tabStyle="account"
action="{!routePage}" >

 

 
 

public PageReference routePage() {
return new PageReference( '/' + acct.id );
}

 

 
 
 
Best Answer chosen by Admin (Salesforce Developers) 
ShamSham

Try setting the url to

 

'/' + act.Id +  '?nooverride=1';