3

I have a custom button on account that's content source is URL. (target page uses opportunity standard controller)

In the url I specify apex page and a parameter ...?retUrl={!Account.id}

Now in the controller getParameters().get('retUrl’) returns the id prepended with host's address.

https://xxxx.visual.force.com/001xxxxxxxxx

Is this a typical behaviour with URL buttons? Typically when I append parameters in apex I get only the value I provided. Is what I observed documented anywhere? I would gladly read more on the subject.

2
  • 1
    What does the URL actually look like when you get the expanded retUrl? I suspect it will include the host details and that Salesforce has replaced your value with its own value. Jun 8, 2014 at 20:10
  • Note that the keys in getParameters are case insensitive and Salesforce uses retURL; you could confirm what Daniel Ballinger suggests by leaving out (or changing the name of) your parameter.
    – Keith C
    Jun 8, 2014 at 20:19

1 Answer 1

3

The most likely scenario here is that Salesforce is overriding your custom parameter with its default value for theretURL parameter. The Salesforce generated value will include the the host access in the URL.

As Keith C points out, PageReference.getParameters() is case insensitive. So calling the method with the retUrl parameter can return the value for the retURL query string parameter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .