You need to sign in to do that
Don't have an account?

Pagereference to change page URL - Set Redirect(true) not working anymore?
I have a page reference that returns me to the object the user started on. It works great, except the URL is still the Visualforce page. It was my understanding that setRedirect(true) accomplished this. I know it used to work like this, but at some point this functionliaty changed and it no longer updates the url.
Anyone know how I can accomplish the URL to be updated with my page reference? It's causing some minor confusion when people "refresh" and end up going to the VF page they just left.
public PageReference SaveProducts() { PageReference ReturnPage = new PageReference('/' + Master.id); ReturnPage.setRedirect(true); return ReturnPage; }
SFDC was good enough to help me from a case.
The issue was that I was working in Development mode. So Salesforce was treating the page as if it had frames. So the page never updated the URL. The moment I turned development mode off it works perfectly.
All Answers
I am have the following code but my page return empty datatable
Code:
public PageReference EditList()
{
PageReference editList = Page.CompAccountEdit;
editList.getParameters().put('id', stdAcct.id);
editList.setRedirect(true);
return editList;
}
if I do the following the list is not empty
code:
public PageReference EditList()
{
return Page.CompAccountEdit;
}
Is there any parameter missing?
SFDC was good enough to help me from a case.
The issue was that I was working in Development mode. So Salesforce was treating the page as if it had frames. So the page never updated the URL. The moment I turned development mode off it works perfectly.
I was also having the same problem, so I turned off development mode. Now, with the same apex code, the page won't redirect at all. Does anyone have any ideas/tips/suggestions?? I have tried with and without the setRedirect option and in versions 15 and 16 of visualforce and apex.
public PageReference cancel() { PageReference pref = new PageReference('/home/home.jsp'); if (retUrl != null && retUrl != '') pref = new PageReference(retUrl); else if (objId != null && objId != '') pref = new PageReference('/'+objId); pref.setRedirect(true); return pref; }
Is there still not a way around it? Sounds like a bug to me.
Your best bet (and its a tad annoying) is to create 2 tabs with the same Visualforce page. On tab 2 you add ?core.apexpages.devmode.url=1 to the url and this will turn off the development mode on the second tab so you can properly redirect.
Hi, how do yo turn development mode off? (I´m working on IE9)
To disable development mode for a particular page you can add a parameter to the URL (is it not working in IE9?). You can read a bit more in this post: http://boards.developerforce.com/t5/Visualforce-Development/How-do-I-turn-off-developer-mode-via-the-URL/td-p/396411
Your other option could be to disable developer mode in your user settings.