Easily Toggle Standard Page Override Using a Bookmarklet

What It Does

This is a bookmarklet that makes it easy to view a standard detail page that is normally overridden by a visualforce page.  I have found this useful because it makes it easier to access the Edit Page Layout link of the standard detail page.  In a few scenarios, I have overridden a standard page only for the purpose of including custom related lists.  The standard detail section is still shown which follows the established page layouts and the easiest way to customize the detail section is still using the Edit Page Layout link.

Make this the URL of your bookmark:

javascript:(function(){if(document.location.pathname.indexOf("/apex/")==0){var id=/(\?|&)id=([a-zA-Z0-9]+)/.exec(document.location.search)[2];document.location="/"+id+"?nooverride=1";}else{document.location=document.location.pathname;}})();

How It Works

An overridden page looks like the URL below with the id being specified as a querystring.

/apex/Account?id=0016000000N1OWK&sfdc.override=1

To view the standard page you must make the URL the following:

/0016000000N1OWK?nooverride=1

Below is the javascript in the bookmarklet:

if (document.location.pathname.indexOf("/apex/") == 0)
{
  //get id from querystring and force nooverride mode
  var id = /(\?|&)id=([a-zA-Z0-9]+)/.exec(document.location.search)[2];
  document.location = "/"+id+"?nooverride=1";
}
else
{
  document.location = document.location.pathname; //strip off search
}
Advertisements