Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Action on RITM to call "Printer Friendly Version"

Corey11
Tera Contributor

I have a need to create a "Print" button on a RITM that will call the "Printer Friendly Version" function. Can anyone assist how to accomplish this?

 

Really, the best answer would be to have the button generate a PDF of the output from the "Printer Friendly Version" function and download it.

2 REPLIES 2

Johns Marokky
Tera Guru

Hi @Corey11 ,

if you are planning to download as an PDF. You can create an UI Actions as below.

Screenshot 2023-03-22 at 9.03.36 PM.png

You can create a separate view which is more specific of what fields needs to be downloaded and you can use that view in the sysparm_view = "" (Currently i am using default view so its left as "").

script:

function onClick() {
    var url = '/' + g_form.getTableName() + '.do?sys_id=' + g_form.getUniqueValue() + '&sysparm_view=' + '' + '&PDF';
    top.window.open(url, '_blank');
}

hope this helps.

 

Mark helpful and accept the solution if it helps in solving your query.

 

Regards,

Johns

Johns, thanks for the quick response. This is not quite what I need though. This is essentially the same as the "Export to PDF" function. The "Printer Friendly Version" is what I need to utilize as it retains the HTML formatting and Look and Feel of the form I want to print.