Quick Message HTML - ServiceNow inserting line breaks

Paul Ciarfella
Tera Guru

I'm experimenting with using the Quick Message for special announcement templates.   ServiceNow seems to be overriding the HTML format of my quick messages, and every message manually typed and sent from the email client with line breaks <br>.

 

For example, my Quick Message template message body is:

 

<p>Hi <employee name=""> ,</employee></p><p>Your account has been granted access.</p><p>Use the credentials to access ServiceNow.</p><p>Regards,</p><p>Account Request Team</p>

 

But the resulting email is - <br> added for every paragraph break.   Replacing the <p></p> with <br> doesn't help - the extra <br> is always inserted.   Using div's does help but that's not a great way to style a message.

 

<html><body>

<br/><p>Hi <employee name=""> ,</employee></p>

<br/><p>Your account has been granted access.</p>

<br/><p>Use the credentials to access ServiceNow.</p>

<br/><p>Regards,</p>

<br/><p>Account Request Team</p>

<br/><div>  </div><div style='display:inline'>Ref:EMCMG0488863</div></body></html>

 

Is there a workaround to this?   Any properties to set?  

7 REPLIES 7

Dan Alexander1
Mega Expert

Hi Paul -- we've long had this issue as well. I usually will go into the HTML code in the quick message and manually remove all the <p> tags that cause the wacky spacing. We've logged the issue with ServiceNow and they have not addressed it. We use HTML for all outgoing messages via the email client, so you can imagine the spacing nightmare this creates for our messages.


Dan - thanks for the reply and confirmation of what I suspected - that its not been addressed by SN and requires a manual fix.   Given how our procedures work, we're going to continue sending the notifications for this particular activity outside of SN.


jakob_richardso
Kilo Contributor

The way I've worked around the funny stuff ServiceNow tries to do with emails is placing everything into a table. With each new line as a new cell in a new row, there's not much that changes in the appearance platform to platform.



An example using your use case:


<table cellpadding="0" cellspacing="0"><tbody>


<tr><td>Hi <employee name=""> ,</employee></td></tr>


<tr><td>Your account has been granted access.</td></tr>


<tr><td>Use the credentials to access ServiceNow.</td></tr>


<tr><td><table cellpadding="0" cellspacing="0"><tbody>


<tr><td>Username:</td><td>${user_name}</td></tr>


<tr><td>Password:</td><td>${password}</td></tr>


</tbody></table></td></tr>


<tr><td>Regards,</td></tr>


<tr><td>Account Request Team</td></tr>


</tbody></table>


Result:


Hi employee,
Your account has been granted access.
Use the credentials to access ServiceNow.
Username:${user_name}
Password:${password}
Regards,
Account Request Team

You can add inline style tags wherever needed to alter the appearance. Just be sure to avoid line breaks within text nodes or it will try to add them. Notice in the source that all line breaks are between rows.



I do agree though that this issue needs to be addressed. Just take my code as I've entered it please, geez. Sometimes I know what I'm doing.


That's a good way to do it for system templates that I define, but I want to give my users the ability to define their own templates, and prefer to not require them to know HTML.