- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2025 12:17 AM
Hi everyone,
I got one requirement where I have to create "print" button inside email body of the notification which should print the whole email content along with template whenever user click on that.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2025 05:26 AM - edited ‎07-23-2025 05:27 AM
You can modify the OOB UI Action "Preview email"
https://[yourinstance].service-now.com/sys_ui_action.do?sys_id=3f018430c0a8006f003b8fe60ba935cf
It calls a ui page where you can modify the html code to print the iframe
https://[yourinstance].service-now.com/sys_ui_page.do?sys_id=3f0dfc2ec0a8006f00955ada093e4bf2
<a href="#" onclick="printBGReport();" align="right">Print Email</a> <br />
<div id="email_preview">
<iframe src='/preview_email_body.do?sysparm_email_sys_id=${sysparm_id}&sysparm_translation=${sysparm_translation}&sysparm_direct=true&sysparm_stack=no' id='email_preview_iframe' width='100%' overflow-y='hidden' overflow-x='auto' frameborder='0' title="${gs.getMessage('Preview Email')}" style="background-color: white" />
<script>
function printBGReport() {
window.frames["email_preview_iframe"].focus();
window.frames["email_preview_iframe"].contentWindow.print();
}
</script>
</div>
PS: Duplicate the ui action and ui page for any modifications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2025 07:07 AM
Hey @Nivetha23jay ,
Most email clients (Outlook, Gmail, etc.) do not execute JavaScript or allow window.print() to run for security reasons. The print button will work if the email is viewed in a browser (e.g., web-view of email or browser-based notification), but not when opened in standard desktop or web email clients. HTML buttons and JavaScript are often sanitized or ignored by email apps, so the button may display as a non-interactive element, or not at all.
Limitation:
Direct print buttons will not function in most email clients due to blocked JavaScript.
Best practice: Add visually styled buttons and clear instructions and provide a web-view link of the email for printing with full functionality if needed.
If your use case absolutely requires a print button in the email, consider including simple instructions along with a visually styled button that looks clickable—but let users know to use their email application's print feature if the button does not work.
Thanks,
Bhimashankar H
----------------------------------------------------------------------------------------
If my answer helps you or resolves your query, please consider marking as 'Accept As Solution'. & 'Helpful' So future readers with similar questions can find it easily.
----------------------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2025 07:28 AM
not possible to handle this within ServiceNow.
Even if you add it also depends on the email client (outlook etc) how it's allowed.
Instead why not train the users from the customer on how to print it from within Outlook itself?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2025 07:35 AM
Thanks for the response ankur but is there possibility to create ui page which displays the notification template( the one we are seeing on preview email) and from there we can keep print button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2025 06:15 AM
I will push back for this requirement.
Not sure why you want this to be handled within ServiceNow and make it complex process.
You can simply ask your customer to train the users receiving email and use the Outlook or any email app print feature.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader