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
AndrewXAndrewX 

Bug in retURL for Override of vf page

Hi,

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:
&retURL=/0018000000XXXXX

In Production it's this:
&retURL=/apex/AccountDetail?id=0014000000XXXXX

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:

https://my_ns_prefix.na2.visual.force.com/apex/AccountDetail?id=0014000000XXXXX&sfdc.override=1
 
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?

 

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

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);
}