+ Start a Discussion
APN09217013342392059APN09217013342392059 

"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 ?
Best Answer chosen by APN09217013342392059
APN09217013342392059APN09217013342392059
Disabling the development mode did the trick and everything worked fine.

All Answers

APN09217013342392059APN09217013342392059
Disabling the development mode did the trick and everything worked fine.

This was selected as the best answer
SijuSiju
A standard button (New, Edit, View, Delete, and Clone) overridden with a Visualforce page doesn’t show up in Salesforce1 unless the Visualforce page is enabled for Salesforce mobile apps.