You need to sign in to do that
Don't have an account?
Wayne Solomon 2016
Visualforce page redirect, http get and NO viewstate fush
Hi
Is there a way to do a Visualforce page redirect, that performs a http get request on the form fields but DOES NOT flush the viewstate.
I'm trying to pass the record type to a single, new instance of a Visuaforce page.
Wayne
Is there a way to do a Visualforce page redirect, that performs a http get request on the form fields but DOES NOT flush the viewstate.
I'm trying to pass the record type to a single, new instance of a Visuaforce page.
Wayne
All Answers
Use
page.setRedirect(false);
For more info:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_System_PageReference_setRedirect.htm
Let me know if you have any issues.
mark it as best answer if it works.
Thanks.
What is happening is that all myinputField values are blank when they are supposed to have their field defaults set.
Ok.Have you tried Wizard based implementation.
Take a look at this
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_wizard.htm
Thanks.
It would be better to share the VF and Controller.
So that I can understand it better.
Thanks.
****Testing2017Dispatcher***
<apex:page standardController="Testing__c" extensions="Testing2017Extension">
<apex:form >
<apex:commandButton value="Pepfar 15" action="{!redirect}"/>
</apex:form>
</apex:page>
****Controller method***
public PageReference redirect (){
PageReference page = new Page Reference('/apex/Testing2017');
this.testing.RecordTypeId = '0122C0000004J6O'; //testing is the sObject variable
page.setRedirect(true);
return testingPage;
}
So, I have InputFields that have default values and when setRedirect(true) the values are populated but I have no record type populated. When I run setRedirect(false), record type is populated but I have no default values. It looks like the constuctor isn;'t running to iniliase the values of my inputFields.
****Constructor snippet***
public with sharing class Testing2017Extension {
Testing__c testing = new Testing__c();
public String selectedSite{get;set;}
public String selectedVenue{get;set;}
public Testing2017Extension (ApexPages.StandardController controller) {
this.testing = (Testing__c)controller.getRecord();
if (this.testing.id != null){
this.selectedSite = this.testing.site__c;
this.selectedVenue = this.testing.venue__c;
}
}
1. Dispatcher page
2. Redirect(false) on the first button press
3. Redirect(true) on the second button press
Like this Thsnks.