We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Email Template does not handle long text and long URL

samadam
Kilo Sage

I have a template that has journal field and when either long text without spaces or a lengthy URL is added it messes up the formatting and goes outside the formatted template. How can I fix this?

1 ACCEPTED SOLUTION
4 REPLIES 4

Sarthak Kashyap
Mega Sage

Hi @samadam ,

 

I tried your problem in my PDI and it works fine for me please check below solution

 

I created a new Notification and a new email template and added the template to my email notification 

 

SarthakKashyap_0-1765007313138.png

 

In my Email Template I wrote below line 

SarthakKashyap_1-1765007340131.png

You can see above that there is random one big single word to handle this issue click on the code icon and add below CSS

SarthakKashyap_2-1765007396400.png

 

SarthakKashyap_3-1765007420390.png

 

<p style="white-space: normal; word-wrap: break-word; overflow-wrap: break-word;">bhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsjbhvbsdhjbdsjvbsdhjvbsdjhvbdshjbvdsj&nbsp;b jhdvh fbsdvhbds bfhsbdshj bfhsdbfhjd bfsbddf</p>

 

<p style="white-space: normal; word-wrap: break-word; overflow-wrap: break-word;">Your comment </p>

 

 

 

Result

Without CSS - you can see scroll is there

SarthakKashyap_4-1765007518207.png

 

With CSS - No scroll and text break 

SarthakKashyap_5-1765007566276.png

 

Let me know if you have any issue!

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak

Missed to include that I use a Email Layout in the template that contains ${notification:body} along with a footer and header. I tried to add the style but did not work:

 

<p style="white-space: normal; word-wrap: break-word; overflow-wrap: break-word;"> ${notification:body}</p>

 

This template/layout is used by multiple notifications.

Hi @samadam , I also shared the same css, 

word-wrap: break-word;.

 

You can mark multiple answer correct in servicenow community.

 

Thanks and Regards,

Sarthak