Friday, July 15, 2011

Override a standard button with Visualforce and Running round and round in circles

Are you that person who overrode the standard button with an awesome Visualforce page. Your page is beautifully working and then at the end want to send the user to the original page which you just override.


Hey you think to yourself, all I got to do to is, copy the original URL in address bar paste it in notepad and add it to the page. As simple as riding a bike.

If you did think this way, you are in for a surprise. Life is not exactly as easy as it seems, for when you override a standard Salesforce button or the link, you automatically override the original page too.

So your little plan goes down the drain and all we see in a infinite loop like this.


It was many many many years ago when I wasted an entire night in this vicious circle and decided to tell you a magic spell to help you out to break out of the circle.

When you pass on the URL of the original page in the Visualforce controller, simply add a URL parameter

noOverride=1

for e.g., suppose you want to pass it to a page, you might possibly want to pass it on to.
http://naX.salesforce.com/somePage

simply add
http://naX.salesforce.com/somePage&nooverride=1 to the page.

With this magic spell, your Visualforce page will magically transfer the control to the original page without redirecting it to itself.

Its been a while I am updating on this blog, but don't worry I have something special getting cooked for the developer community. I will be around. Thought many users are busy with #DF11 one small recipe will not harm anyone.

Toodles,
Sid
P.s. Talking about spells, Harry Potter 7 part II was released today. Sigh.
Share:

0 comments:

Post a Comment