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

HarshTimes
Tera Guru

Hi Bryan
I also faced this issue earlier.I think there is some issue with the service-now html textbox.I will suggest you to create the hml template in a javascript editor/html editor first and then copy that to your email template.

Thanks
Harsh


jmfonseca
Tera Contributor

Hi guys,



Same symptom here...



I followed the advice of editing in a proper editor and it worked out.



Greets


Hi mfonseca,



This seemed like a sensible solution, so I gave it a try, but my results were not different.


Perhaps I did not use a good editor.   Could you reply with the editor you used successfully?



Thanks,
Bob


awright
Kilo Expert

We also encounter this in some cases. The worst part is that the & nbsp tag can't be saved into the script editor so we can't remove it with a string replace without splitting it up (and its effectiveness once this has been done seems dubious as it works in some cases but not in others).



I believe it has something to do with TinyMCE editor, but there's no way to get at the settings that automatically add p tags to my knowledge.