4

Hi I am using the sendEmail from the flow sample pack to send an email under specific conditions. This is working. How ever the email content is not keeping the linebreaks as entered by the user during flow runtime.

I am using a long text area to enter the note.

Thanks in advance Barry

The Apex class creates a string called body from data passed by the flow as follows:

  String body = (String) request.inputParameters.get('body');

and uses it in a sendEmail method as follows:

  message.setHtmlBody(body != null ? body : '');  // If the body is empty, use an empty string
4
  • 1
    sample code will help .How is body being referenced in apex ? – Mohith Shrivastava Dec 2 '13 at 8:27
  • The flow is the "Send Email Apex Plug-in Sample" from the sales force flow samplepack – Barry Dec 2 '13 at 22:58
  • @MohithKumar the code for Send Email is ..... – Barry Dec 2 '13 at 23:00
  • I edited to add the code, but I am wondering if this is just something funny about how the RTE creates the HTML for the body. Can you look at the code that is being created by the RTE and passed from the flow? – snugsfbay Dec 19 '13 at 0:19
3

The line breaks the user is entering is more than likely plain text \r\n... but you need <br /> for the html body. Try setting the email plain text body and see if the line breaks are working. If so, this could be a possible solution:

String body = ((String)request.inputParameters.get('body')).replace('\r\n','<br \>');

If this was helpful please mark as answered. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.