+ Start a Discussion

Bug in retURL for Override of vf page


I have overridden the Standard Delete link on my Custom Object with a custom visual force page. When I click the 'Del' link in a related list of my Custom Object, it shows my custom delete page correctly. However, the retURL parameter that Salesforce injects for the page differs between the Developer Edition and Production environments:


In Developer Edition it's this:

In Production it's this:

This difference wouldn't normally be a problem, but this code is part of a custom app with a namespace prefix. I have a cancel button on my custom vf page, and when the user hits this cancel button, I navigate to the retURL. In Dev Edition the retURL works fine; in Production, i get an error.

Here's the problem:

The fully resolved url doesn't work in Production. Here it is:

As you can see, it prepends my app's namespace prefix to the url instead of the normal c.na2.visual.force.... and I get the following error:

URL No Longer Exists
You have attempted to reach a URL that no longer exists on salesforce.com.  

Can anyone suggest a work around?


Can you make a custom Del link that points to the proper URL always?

Hi Werewolf,


What I ended up doing is this:



public PageReference init()
this.retUrl = ApexPages.currentPage().getHeaders().get('Referer');

 Then in my cancel handler:



public PageReference cancel()
return new PageReference(this.retUrl);