function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Meeta Khullar 5Meeta Khullar 5 

Pass parameter to VF Page with same controller

I have 2 visualforce page with the same controller. One is used for the user to input the data to get the output accordingly. The other one is built to generate the csv file for the output of the first visualforce page. The problem that I'm having is the input parameter that is provided in the first page is not passing onto the second visualforce page. Because of which the csv file is exporting all the data from the database and not filtering based on the input of the user. How can I pass the input parameter into the second page.

Here is the input that is passed in the first VF page


 <apex:page controller="RMSControllerTest"  title="Physico" docType="html-5.0" showHeader="true"  cache="true">

 <apex:form >
 
    <apex:pageBlock title="Revenue Recognition test">
           <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
            
            <apex:facet name="header">
                <span style="color:black">Enter Search Details</span>
            </apex:facet>
        
            <apex:outputlabel value="From:"/>
               <apex:input type="date" value="{!startDate}" size="10" id="StartDate" onfocus="DatePicker.pickDate(false, this , false);" />
            </apex:pageBlockSectionItem>  
            
            <apex:pageBlockSectionItem >
                <apex:outputlabel value="To:"/>
               <apex:input type="date" value="{!endDate}" size="10" id="Enddate" onfocus="DatePicker.pickDate(false, this , false);" />          
               <!--<apex:input value="{!endDate}" size="10" id="EndDate" onfocus="DatePicker.pickDate(false, this , false);" /> -->
            </apex:pageBlockSectionItem>
            
             <apex:inputText id="ordernumber" title="Order No." value="{!orderNumber}" label="Order No." />
           
             <apex:inputText id="invoiceNumber" title="Invoice no" value="{!InvoiceNo}" label="Invoice No."/>


Here is the controller and the coding to call the next VF Page when the user click "EXPORT TO CSV"

public PageReference Import() {
    
      PageReference logPage = New PageReference('/apex/RevenueRecognizedTestExport?sfdc.tabName=06655000000DFAA');
      
      logPage.setRedirect(true);
      return logpage;
    }


Here is the other VF PAge that is generating CSV file

<apex:page controller="RMSControllerTest"  contentType="application/vnd.ms-excel#ConsignmentSearchData.csv" cache="true" >
    Invoice Number,Invoice Line Name,Product Name, Product Line, Start Date, End Date, Recognized Revenue, Deferred Revenue, Total Amount, QAD Domian, Created Date
    <apex:repeat value="{!invoiceLines}" var="item">
        {!item.invoiceLine.invoice__r.name},{!item.invoiceLine.name},{!item.invoiceLine.Order_Product__r.PricebookEntry.product2.name},{!item.invoiceLine.Order_Product__r.PricebookEntry.product2.Product_Line__c},{!item.invoiceLine.Start_Date__c},{!item.invoiceLine.End_Date__c},{!item.recognizedRevenue},{!item.deferredRevenue},{!item.totalAmount},{!item.invoiceLine.Order_Product__r.order.account.QAD_Domain__c},{!item.invoiceLine.CreatedDate}
    </apex:repeat>
Meeta Khullar 5Meeta Khullar 5
This is how the issue got resolved. I made the setRedirect(false) instead of true and it worked

public PageReference Import() {
    
      PageReference logPage = New PageReference('/apex/RevenueRecognizedTestExport?sfdc.tabName=06655000000DFAA');
      
      logPage.setRedirect(true);
      return logpage;
    }