The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to add print button inside email body of the notification

Nivetha23jay
Tera Contributor

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.

1 ACCEPTED SOLUTION

Pranesh072
Mega Sage
Mega Sage

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}&amp;sysparm_translation=${sysparm_translation}&amp;sysparm_direct=true&amp;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>

 

Pranesh072_0-1753273535983.png

 

Pranesh072_1-1753273568968.png

 

PS: Duplicate the ui action and ui page for any modifications.

View solution in original post

6 REPLIES 6

Pranesh072
Mega Sage
Mega Sage

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}&amp;sysparm_translation=${sysparm_translation}&amp;sysparm_direct=true&amp;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>

 

Pranesh072_0-1753273535983.png

 

Pranesh072_1-1753273568968.png

 

PS: Duplicate the ui action and ui page for any modifications.

Thanks a lot pranesh..it works