UI Action to export a form to pdf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2011 03:11 PM
I am trying to create a button to export my problem form to pdf. Is it possible to call Export > PDF > Portrait context menu using UI Action?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 11:51 PM
Hey addenkik,
You can create a UI Action form button with the folowing script to export the form to pdf :-
Client : ticked
Form Button : ticked
Onclick : exportPDF()
Script :
function exportPDF() {
var sysparm_table = g_form.getTableName();
var sysparm_sys_id = g_form.getUniqueValue().toString();
var a='https://dev00000.service-now.com/';
var url = a+sysparm_table + '.do?PDF&sys_id=' + sysparm_sys_id;
g_navigation.openPopup(url);
}
NOTE : In var a write your own developer instance url.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2021 04:17 AM
I want the same thing but instead of PDF I want to export form data to Excel. Can you please guide me for this?
Thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2019 02:43 AM
how to create export to PDF as a button on incident form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2019 03:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2019 06:35 AM
Hi Namrata,
It seems your ui action is calling ZIP not PDF according to your screenshot, check if you have PDF plugin already installed in your instance. Also use this code below, I have changed it to get your current instance name replacing the hard coding on it.
function exportPDF() {
var sysparm_table = g_form.getTableName();
var sysparm_sys_id = g_form.getUniqueValue().toString();
var a=gs.getProperty("instance_name");
var url = a+sysparm_table + '.do?PDF&sys_id=' + sysparm_sys_id;
g_navigation.openPopup(url);
}