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
Mike SladeMike Slade 

End of Line Character in apex:emailPublisher

I'm trying to create a way to create a case and send an emails using the apex:EmailPublisher tag.  It's all working except a couple cosmetic things.


   <apex:emailPublisher autoCollapseBody="false"    onSubmitSuccess="redirectPage()" emailBodyFormat="HTML" emailBody="{!caseTag}" enableQuickText="true"  showAdditionalFields="true" entityId="{!caseId}" emailBodyHeight="30em" expandableHeader="false" sendButtonName="Send Email" bccVisibility="editable" ccVisibility="editableWithLookup" title="Compose Outgoing Email" width="70%"></apex:emailPublisher>


I need to add the case tag (which is a formula field based on ID) to the email so the email to case threads it to the same case, but I want to put a couple empty lines before it, so the users have room to compose.  Is there any way to add new line characters here.  I've tried both on the apex and VF side these two methods.  '\n\n' + caseTag  and '<html><br/><br/>' + caseTag + '</html>'. It looks like it just ignores any tagged text and prints the \n's.



There is a way of using \n in the code.
Try below
Try using html codes for new line and carriage return, LF - &#x0A;, CR - &#x0D;, CRLF - &#x0D;&#x0A; instead of using \n or <br />
Mike SladeMike Slade

That didn't work, but it got me thinking.  I got it to work in Javascript.  In my page , the text area for the email is the only text area with a name.


<script type="text/javascript">
window.onload = new function() { addEndLine(); };
function addEndLine()
//add return characters to the first of the email composer
var textAreas=document.getElementsByTagName("textarea");
for (var i = 0; i < textAreas.length; i++)
if (textAreas[i].name.length>0)
textAreas[i].value = '<BR><BR><BR>' + textAreas[i].value;
i = textAreas.length;