• Michael_FR78
  • NEWBIE
  • 0 Points
  • Member since 2009

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

Hi,

 

I've run into a very annoying problem. I have a simple visualforce page that displayes an organizations address pulling from the organization fields, like so:

 

 

<apex:outputText value="{!SUBSTITUTE($Organization.Street, '\n', '<br />')}" escape="false" /><br /> <apex:outputText value="{!$Organization.City}" />, <apex:outputText value="{!$Organization.State}" />&nbsp;<apex:outputText value="{!$Organization.Country}" />&nbsp;&nbsp;&nbsp;<apex:outputText value="{!$Organization.PostalCode}" /> <br />

As you can see I'm tyring to replace the new line character with html break tags. Unfortunately it doesn't seem to be picking up the newline character. I really don't want to write custom controller just to generate a string with proper line breaks (this is all the controller would do for this page, I have no need for anything else). Is there a different character for line breaks that I'm missing? 

 

 

 

  • April 22, 2009
  • Like
  • 0
I have the following code in my email to case class:
 
global class EmailToCase implements Messaging.InboundEmailHandler {
global Messaging.InboundEmailResult
 handleInboundEmail(Messaging.inboundEmail email,
 Messaging.InboundEnvelope env){
// Create an inboundEmailResult object for returning the result of the Force.com Email Service
Messaging.InboundEmailResult result = new Messaging.InboundEmailResult();
 
system.debug('\n\nTo: ' + email.toaddresses[0] + '\nFrom: ' + email.fromaddress + '\nSubject: ' + email.subject + '\nBody: ' + email.plainTextBody + '\n');
 
// remove confidentiality notices from email body
if (email.plainTextBody.contains('CONFIDENTIALITY NOTICE:')) {
    i = email.plainTextBody.indexOf('CONFIDENTIALITY NOTICE:');
    email.plainTextBody = email.plainTextBody.substring(0,i-1);
}
 
and this afternoon I have started to get this error in my debug log:
Subject: xxxxxxxx
Body: null

System.NullPointerException: Attempt to de-reference a null object
Class.EmailToCase.handleInboundEmail: line 22, column 5
 
Line 22, column 5 is trying to reference email.plainTextBody for the first time (.contains).  This has been working for a few weeks.  Has something changed at Salesforce with the inbound email, or do I need to code for some e-mails to actually have a null email.plainTextBody?  The e-mails I received from our mail server do in fact have a body with normal text and a confidentiality notice.  Any ideas?
 
Thanks