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
D'Mario LewisD'Mario Lewis 

Can I redirect to another page with the variables included

public PageReference report(){ 
    	PageReference np = null;
    	
        starts = startDate.format(); //formats date as MM/DD/YYYY 
        ends = endDate.format();
        
        String value = getClassisObject().get(0).getValue();
        
        if(reportObj.equals('church')){
            String[] splitter = churchObj.split(':');
            churchReport(year, splitter[0].trim(), startDate,  endDate);
            
            np = new PageReference('/apex/crcna_MinistryShare_ChurchReport');
        }
        
        if(reportObj.equals('full')){
            List<Account> lstClassis = ClassisList(classisObj, value, reportObj);
            List<Account> lstChurches = ChurchList(lstClassis);
            if(classisObj <> value){  
                lstSubtotals = fullDetail(countryObj, lstChurches, year, startDate, endDate);

            np = new PageReference('/apex/crcna_MinistryShare_ClassisReport');

            }
       }
np.setRedirect(true);
return np;
}
AMIT KAMBOJAMIT KAMBOJ
Hi,
Please see below to set variables. Please mark this answer as solution if this resolves your question.
public PageReference report(){ 
    	PageReference np = null;
    	
        starts = startDate.format(); //formats date as MM/DD/YYYY 
        ends = endDate.format();
        
        String value = getClassisObject().get(0).getValue();
        
        if(reportObj.equals('church')){
            String[] splitter = churchObj.split(':');
            churchReport(year, splitter[0].trim(), startDate,  endDate);
            
            np = new PageReference('/apex/crcna_MinistryShare_ChurchReport');
        }
        
        if(reportObj.equals('full')){
            List<Account> lstClassis = ClassisList(classisObj, value, reportObj);
            List<Account> lstChurches = ChurchList(lstClassis);
            if(classisObj <> value){  
                lstSubtotals = fullDetail(countryObj, lstChurches, year, startDate, endDate);

            np = new PageReference('/apex/crcna_MinistryShare_ClassisReport');

            }
       }
np.getParameters().put('variablename1', variablename1value);// replace by actual names
np.getParameters().put('variablename2', variablename2value);// replace by actual names   

/* Example is below
np.getParameters().put('errorNum', errorNum);
np.getParameters().put('errorMessage', errorMessage);	   
*/
np.setRedirect(true);
return np;
}
Pankaj_GanwaniPankaj_Ganwani
Hi,

Instead of making np.getParameters.put() method each time to add variable as parameter, we can use a map of type <String,String> which will contain all the mappings related to the variables which need to be passed by URL.

At last we can use np.getParameters().putAll(map) to add all the parameters in one go.

Thanks,
Pankaj