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
SharadSharad 

Problem with retURL

Hi,

 

Let me first describe the scenario. I have one 'Reject' button on Opportunity detail page. On click of which a VF page is called and it displays the detail of that opportunity after making few changes to the record. So far so good.

 

After that if user clicks on standard 'Edit' button on the same detail page. Salesforce sets the value of retURL automatically to the URL of the VF page which was called on the click of 'Reject' button. This makes the reject controller to be called again on click of 'save' button, which should not happen.

 

How to override/change the behaviour of retURL being change on its own. I need the default value of this parameter.

 

Thanks !

 

Sharad

Best Answer chosen by Admin (Salesforce Developers) 
SharadSharad

Thanks for your reply. I assume you meant to call this code through a VF controller and override the standard edit button to call a VF page which would call this method.

 

I did exactly the same and it worked. However, there is one thing that your code goes on infinite loop. To avoid that, I appended '&nooverride=1' as parameter to the url and it worked perfectly fine.

 

 

Thanks !

 

Sharad

All Answers

jeffdonthemicjeffdonthemic

You can do something like:

 

 

public PageReference edit() { PageReference myPage = new PageReference('/'+this.id+'/e?retURL=%2F'+this.id); myPage.setRedirect(true); return myPage; }

 

Hope this helps.

 

Jeff Douglas

Informa Plc

http://blog.jeffdouglas.com

 

SharadSharad

Thanks for your reply. I assume you meant to call this code through a VF controller and override the standard edit button to call a VF page which would call this method.

 

I did exactly the same and it worked. However, there is one thing that your code goes on infinite loop. To avoid that, I appended '&nooverride=1' as parameter to the url and it worked perfectly fine.

 

 

Thanks !

 

Sharad

This was selected as the best answer