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.

Generate PDF from UI action

Juhi Jha
Tera Contributor

I have created a UI action which generates a print view which unnecessarly adds mores steps for the client to download pdf i want to download pdf by clicking of the button in the bellow format .

 

13 REPLIES 13

hi, 

But i want my pdf format to be like this 

find_real_file.png

your script is giving me below format 

 

Can you send me you code so that i can have a look at it?

function generatePDF(){
var sysparm_table = g_form.getTableName();
var sysparm_sys_id = g_form.getUniqueValue().toString();
var link='https://dev113064.service-now.com/'; // Replace with your Instance url
var url = link+sysparm_table + '.do?PDF&sys_id=' + sysparm_sys_id;
g_navigation.openPopup(url);

}

Hello,

No what i meant was can you send me the script you have written to get that print view

Thanks.

var view = 'pdf_view';

var url = '/' + g_form.getTableName() + '.do?sys_id=' + g_form.getUniqueValue() + '&sysparm_view=' + view + '&sysparm_media=print' ;
window.open(url,"_blank");