3

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.

  • Security Controls > Session Settings this should solve your issue ? – Ratan Paul Mar 30 '16 at 2:47
  • nope it did not solve my issue – Nick Kahn Mar 30 '16 at 3:11
  • Try removing the line param.putAll(ApexPages.currentPage().getParameters()); – Jenny B Mar 30 '16 at 4:19
  • Not sure which parameter is causing the issue but I remember someone else running into this issue before. – Jenny B Mar 30 '16 at 16:40
  • Saw your comment on my question from yesterday, but it looks like Jenny has figured it out already. What you need to do now is review all the parameters you are getting from the current page using ApexPages.currentPage().getParameters() - using debug logs with system.debug() is how I would check that. – smohyee Mar 30 '16 at 17:59
4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.