Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Excessive HTML Spacing when using the Email Client (<p> </p>)

brnunn
Tera Contributor

Hi all,

I really am perplexed by this issue - maybe it's an HTML nuance I'm not familiar with.

When using (and only when using) the email client (notifications do not do this) within a SNow case, every time that SNow interprets a new line (< p>) it creates a ridiculous amount of white space between the paragraphs. I just want our users to be able to push enter and it creates a line break when sending an email from within the case. The HTML format has "paragraph" set as the default and every new line entered creates 2-3 lines of white space in the final result.

We are trying to plug in templates for copy/paste within SNow email client but it interprets the HTML in wonky ways. I can deal with doing some text editing before hand but...

for example: creating a bullet list puts it in a paragraph block, creates a paragraph line between each bullet item AND inserts this special character above the list < p> & nbsp;< /p>. A three item bullet point list is now taking up HALF the page in the final email.

Why does it generate < p> & nbsp;< /p> between special format sections? How do I stop this??

Any help would be so appreciated. (Added spaces in html chars so it would be visible)

Thanks in advance!!!!!!!!!

1 ACCEPTED SOLUTION

brnunn
Tera Contributor

Guys I opened a HI ticket and was provided a solution that I could tailor to work.


It's still a broken process but you can fix it by grabbing and deleting the extra carriage return tags with the following business rule. I haven't thoroughly tested it but in my first few trials it seems to work just fiiine. Was simpler than it seemed.



Business Rule: Fix Client Spacing


Table: sys_email


When: before
Update: true
Active:true


Script:
current.body = current.body.replace(/<br\/>/g,'');


View solution in original post

15 REPLIES 15

olga_antonova
Tera Contributor

Also faced this issue, for me moving <br> tag to the email script helped (Kingston version)