How to keep xml formatting in html notification?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2017 03:46 AM
We are exchanging code with a 3rd party tool (EasyVista). To do so, we send them xml over SOAP. When something goes wrong, we want to send the xml content that was sent through email to verify the root-cause of the problem. To do so we created an event, containing the xml output, and added it to the notification. The problem is that the spacing goes haywire. How can we keep the correct formatting?
Code used to trigger the Event:
Notification:
Email body:
Email preview:
So how do I keep the correct spacing? What tag should I use? I tried <pre>, but it was removed when I saved the Notification 😕
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2017 07:31 AM
Hi Peter,
If you want the xml tags to be displayed in new line then you could use <br/>. Below link may help you to white list other tags for HTML editor.
http://wiki.servicenow.com/index.php?title=HTML_Sanitizer#gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2017 07:48 AM
Hi Peter,
did you try to create event without using GlideStringUtil.escapeHTML() method? I mean: gs.eventQueue(...., this.soap.getRequestBody()).
This should work if you change the content type field to Plain text only in Notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2017 08:30 AM
This would mess up ${URI_REF}, the bold and underlined text though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2020 10:34 AM
Not 100% sure what you're after, but I'm guessing you want to azure that the xml string starts with a new line after every end tag? if so, just try something like this: yourXml.toString().replace(/<\//g, '\n<\/');