[SalesForce] The page you submitted was invalid for your session

EDIT:

enter image description here
I have overridden the New button in Case object and opening a Visualforce page but if I open the page using preview VFP I'm not getting the error and its happening only when I click on NEW button.

I have looked at this question but did not help me fix the issue i'm having.

Visualforce page:

<apex:page standardcontroller="Case" extensions="caseExt" action="{!redirectPage}">
<apex:form id="form">
    ......
    ......

    </apex:form>
</apex:page>

Controller:

public PageReference redirectPage() 
{
  PageReference page = new PageReference('/' + Case.SObjectType.getDescribe().getKeyPrefix() + '/e');
  Map<String, String> param = p.getParameters();
  param.putAll(ApexPages.currentPage().getParameters());                       
  param.put('nooverride', '1');                        
  page.setRedirect(true);
  return page;

}

Error: Invalid Data.
Review all error messages below to correct your
data. The page you submitted was invalid for your session. Please
click Save again to confirm your change.

Best Answer

The problem is with this line here param.putAll(ApexPages.currentPage().getParameters()); and in particular with the save_new parameter that is being added to the URL causing the error. Similar issue here, Error while PrePopulating Name in Opportunity

Related Topic