Displaying Email Layout in Notification

damirdoszhan
Tera Contributor

Dear Community!

I created new email layout with company's branding needs, added it to email templates with notification email scripts and chose in notification to

display specific text in custom format. But there is a problem, system is not displaying email layout when I press "Preview Notification" button.

It displays only mail scripts values from email templates. I have tested this option in developer instance too, but there was a same problem.

Thanks in advance!

1 ACCEPTED SOLUTION

I too am having the same problems. When I copied the original notification (via Insert) it would not work. By exporting the records as XML and comparing in Notepad++, I found a difference from the inserted version.



Wherever a variable is called out as ${variable}, in the version that was copied it was actually stored as $X{variable} where X is an invisible invalid character. The only way I could delete that invalid character (X) was to check the box for Advanced, paste in there. Then I put my cursor between the $ and {, and pressed delete.



Once you press delete, the { and corresponding } will light up green, indicating those are currently highlighted by the cursor. Doing that for all ${variable} references made this work by means of previewing.




Now I am trying to make my custom template work. I'm finding I can only work with Advanced, and it is VERY, VERY picky on what it will accept and render. So far I've had to scrap my template, and just slowly change the original one piece by piece.


View solution in original post

15 REPLIES 15

sebastian_g_snc
ServiceNow Employee
ServiceNow Employee

Hi Damir,


could you be a little more specific?


What is being displayed?


If you use emails script and want to create a certain layout, you basically need to create a HTML string in the email script.


Kind regards



Sebastian


damirdoszhan
Tera Contributor

Thanks for your reply!



In email layout, I constructed external layout for message. Used same approach as Demo Layout - Light.


In notification mail scripts, I displayed information of incident ticket with some CSS styling.


In email template, I included set of notification mail scripts as header, body, footer. Also, in this template I indicated to previously defined email layot.


In notification, I indicated to email template.



So, I would like to see such type of messages with some text instead of ${notification:body}



5.png


But, I only get raw text without email layout styling. For instance:



Caller: Fred Luddy


Short Description: Problems with email layout.


----------------------------------------------------------------------------------------------------------------------------



Which is not wrapped in email layout. Hope to find solution.



Thanks in advance!


sushant06251
ServiceNow Employee
ServiceNow Employee

Hi Damir,


I also faced the same problem today.



I found following few points worthy:


1. Make sure you are not using span in your Email template. If using make sure it is closed properly.


2. If this doesn't solve the problem try to copy your Email Layout generated source code to a editor and remove all line endings. That is replace minify your code. Then delete the full source code from you Layout page and click OK. Now you will see a blank canvas in Layout. Again open up the source and paste the minified code you created. Save. This might solve the problem.



I believe the problem is coming because code is not not being able to rendered properly thus system skipping the layout and just printing the template text.



Please let me know if this solved your problem so that i can raise a defect to platform team for them to investigate.damirdoszhan


I am having the same issue in our system and have been searching for a resolution for several days. Unmodified demo layouts work as expected. All new templates (including identical copies of the demo template created using the Insert action) do not work at all. The source code for the functional and non-functional layouts appears identical.