• Andrew Mc.M
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

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.

Hi,

 

I have a visualforce email template which is related to a custom object. In the template I have the following line where Agenda_Objective__c is a long text area.

 

 

<apex:outputText value="{!relatedTo.Agenda_Objective__c}"/>

 

 If there are any line breaks in the field in the custom object, they do not come through in the email template.

E.G. if the field contains the text:

 

Test1

Test2

Test3

 

the mail will display

 

Test1 Test2 Test3

 

Is there any way of preserving the line breaks? I could use outputfield instead of outputtext but this puts extra javascript into the mail which causes an error in my email client.

 

  • December 14, 2009
  • Like
  • 0