Skip to content

Commit a13298f

Browse files
authored
Print friendly UI action (#2638)
* Create printer_friendly_verison.js * Create README.md
1 parent 6f1bdbf commit a13298f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Overview
2+
3+
4+
This code snippet UI Action will allow you to have a printer friendly version of whatever record you might are trying to print.
5+
This UI action uses the GlideNavigation API which you can find here [GlideNavigation API](https://developer.servicenow.com/dev.do#!/reference/api/zurich/client/c_GlideNavigationV3API#r_GNV3-openPopup_S_S_S_B)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
printView()
2+
3+
function printView() {
4+
5+
var table = g_form.getTableName();
6+
var recordID = g_form.getUniqueValue();
7+
var view = {{Insert the view you want to print here}}; //You can pass in an empty string and it will still work
8+
var windowName = {{Insert the name you want your window to display}}; //You can pass in an empty string and it will still work
9+
var features = 'resizeable,scrollbar'; //You can pass in an empty string and it will still work
10+
var urlString = '/' + table + ".do?sys_id=" + recordID + "&sysparm_view=" + view + "&sysparm_media=print";
11+
var noStack = true; //Flag that indicates whether to append sysparm_stack=no to the URL
12+
13+
g_navigation.openPopup(urlString, windowName, features, noStack);
14+
15+
}

0 commit comments

Comments
 (0)