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
Andrew Mc.MAndrew Mc.M 

Issue grabbing inputfield value and using on select in controller

Hi folks, hoping someone can help me out on this one, basically I have an inputfield on my visualforce page whereby the user selects a service via a lookup and I want the SOQL query within the controller to use the value in this field when making the select. 

The issue is that it is not picking up the value entered on the page, and I cant see where I have gone wrong, anyone got any ideas? (please see shortened code below)

 

Controller:

 

public without sharing class ReportModifiedEmailAddressController {

  //Collection of the class/wrapper object allObjects
  public List<allObjects> theReportList {get; set;}  
  public Other_Reports__c otherReportDesc {get; set;}
    
  public ReportModifiedEmailAddressController(ApexPages.StandardController controller) {
    this.otherReportDesc = (Other_Reports__c)controller.getRecord();
  }

  //populate the wrapper
  public List<allObjects> getReportInfo() {
  
        if(theReportList == null) {
            theReportList = new List<allObjects>();
            
            // Start gathering the data from the applicable tables
            system.debug('Service is: '+otherReportDesc.Modified_Email_Service__c);
            
            // Find the relevant Issuer Services from the contacts in the contact history table, i.e. whose email address has changed between the dates specified 
            List<IssuerServices__c> issuerServiceList = [select id, status__c from IssuerServices__c where contact__c in (select contactid from ContactHistory where field = 'Email') and service__c = :otherReportDesc.Modified_Email_Service__c order by contact__c desc]; 

            // Build the actual wrapper list from the Main Issuer Service List                      
            for(IssuerServices__c iss: issuerServiceList) {                     
              theReportList.add(new allObjects(iss));           
            }                      
        }
               
        return theReportList;
    }
  
  // This is our wrapper/container class. 
    public class allObjects {
        public IssuerServices__c issue {get; set;}   
        public allObjects(IssuerServices__c iss) {
            issue = iss;          
        }
    }  
 
  // Method to pull the info into the visualforce page    
  public pageReference getresults()
  {
    getReportInfo(); 
    return null;  
  }       
     
}

 

Visualforce Page:

 

<apex:page standardController="Other_Reports__c" extensions="ReportModifiedEmailAddressController" tabStyle="Other_Reports__c" >
  <apex:sectionHeader title="{!$Label.Other_Reports}" subtitle="{!$Label.Report_ModifiedEmailAddress_Search}"/>
   <apex:form id="frm" >        
        <table class="list" width="100%">
            <tr class="dataRow" align="left">
                <td class="labelCol" colspan="2"><b>{!$Label.Report_ModifiedEmailAddress_Description}</b></td>
            </tr>
            <tr class="dataRow">
                <td class="labelCol" style="width:200px;" > Service:</td>
                <td class="dataCell" >  
                     <apex:outputPanel >
                       <apex:inputField value="{!Other_Reports__c .Modified_Email_Service__c}"/> 
                    </apex:outputPanel>                
                </td>              
            </tr>             
            <tr class="dataRow">
                <td class="labelCol" style="width:200px;" ></td>
                <td class="dataCell" >  
                     <apex:outputPanel >
                        <apex:commandButton value="Search" action="{!getresults}" immediate="false"/>
                    </apex:outputPanel> 
                </td>              
            </tr>      
        </table>        
        <apex:pageBlock id="resultblock" title="{!$Label.Report_ModifiedEmailAddress_Header}" mode="edit">     
        <apex:pageBlockSection id="resultsBlock">   
            <!-- In our table we are displaying the getReportInfo records -->
            <apex:pageBlockTable value="{!ReportInfo}" var="is" id="resultstable" rendered="{!NOT(ISNULL(Other_Reports__c.Modified_Email_Service__c))}">
                <!-- This is how we access the contact values within our getReportInfo container/wrapper -->
                <apex:column value="{!is.issue.Status__c}" />                
            </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

Any help/advice is much appreciated.