How to Generate PDF from UI action.
Import
·
Feb 18, 2024
·
article
Generate PDF from UI action
Sample code :
You can use the below code in your UI action to generate a PDF.
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 sys_parm to get the instace name
var url = link+sysparm_table + '.do?PDF&sys_id=' + sysparm_sys_id;
g_navigation.openPopup(url);
}
Note:
1. Recommend to use sys_property to build the url.
2. You can use page_view in URL for a specfic view of fields using sysparm_view.
<<< Top Articles >>>
MF Sohail Khilji | Servicenow Developer / Consultant.
View original source
https://www.servicenow.com/community/itsm-articles/how-to-generate-pdf-from-ui-action/ta-p/2831049