You need to sign in to do that
Don't have an account?
APN09217013342392059
"New" button override and Page Redirect not working
I have a custom object and I have overridden "New" button for this object.
On click of "New" I am showing a visualforce page with standard controller and extension.
There is a "Submit" button on this VF page and on cliclk of this button, Visualforce page calls a action method in the controller extension, which inserts a new record. After inserting this record I want to redirect use to the detail page of this record.
I am returning PageReference from my action method. But I see that redirect never happens and UI shows blank.
below the code snippet of my action method
public PageReference ValidateAndSave()
{
insert refundGroup; //insert the record here
system.debug('refund group id - ' + refundGroup.Id);
//redirect to the newly created RefundGroup record
PageReference pageRef = new PageReference('/' + refundGroup.Id + '?nooverride=1');
pageRef.setRedirect(true);
return pageRef;
}
Please note the use of nooverride=1 in the URL.
this successfully inserts a record but never redirects to the detail page of the inserted record.
Any idea what is going on here and why redirect is not working ?
On click of "New" I am showing a visualforce page with standard controller and extension.
There is a "Submit" button on this VF page and on cliclk of this button, Visualforce page calls a action method in the controller extension, which inserts a new record. After inserting this record I want to redirect use to the detail page of this record.
I am returning PageReference from my action method. But I see that redirect never happens and UI shows blank.
below the code snippet of my action method
public PageReference ValidateAndSave()
{
insert refundGroup; //insert the record here
system.debug('refund group id - ' + refundGroup.Id);
//redirect to the newly created RefundGroup record
PageReference pageRef = new PageReference('/' + refundGroup.Id + '?nooverride=1');
pageRef.setRedirect(true);
return pageRef;
}
Please note the use of nooverride=1 in the URL.
this successfully inserts a record but never redirects to the detail page of the inserted record.
Any idea what is going on here and why redirect is not working ?
All Answers