Maik Skoddow
Tera Patron
Tera Patron

find_real_file.png

 

A question arose in the community as to whether it would be possible to open a printer friendly version of the record view from within the Workspace.

Basically OOTB there is no option but you can create a simple UI Action to provide your agents with such a view.

In order not to reinvent the wheel, the built-in but somewhat hidden print version is used. To find that option, click on the wheel in the upper right corner of the classic interface and change to tab "General" click on printer icon:

 

find_real_file.png

 

After clicking on printer icon a window is opened and the current URL is loaded with an additional URL parameter "sysparm_media=print" at the end.

This parameter ensures that the page is rendered with minimal and printer friendly contents.

Back to Workspace. The detail view of a record is rendered there with the help of the view "Workspace". With this knowledge, a URL can now be assembled that loads the current record in the printer friendly version from the "Workspace" view.

The complete UI Action should be configured as follows:

 

NamePrint Version
TableGlobal
Activetrue
Show updatetrue
Clienttrue
Workspace Form Menutrue
Workspace Client Script
function onClick(g_form) {
  var url = '/' + g_form.getTableName() + '.do?sys_id=' + 
            g_form.getUniqueValue() +
            '&sysparm_view=Workspace&sysparm_media=print';
	
  top.window.open(url, '_blank');
}

 

As a result you will find the new menu item at any record view:

 

find_real_file.png

Comments
Cat Michalak
Tera Contributor

Hi Maik, 

This is really helpful, thank you.

I was wondering if there's a way to limit / choose what can be printed.

Currently, the ribbon and header details are not included.

However other items are included such as HR Tasks, Emergency contacts, Cases opened for user, similar cases,Interactions, Articles read, etc.

These would be irrelevant for printing in most cases, blank in many cases, and I'd either like for it to be excluded or the person printing to be able to choose.

Any advice on this would be great.


Thanks

Catherine

Maik Skoddow
Tera Patron
Tera Patron

Hi @Catherine Michalak 

unfortunately there is no control over the rendered contents as just an OOTB feature is leveraged.

Kind regards
Maik

Melissa Bennett
Tera Expert

@Maik Skoddow ,

On this UI Action, I would also like to add a UI Action button to the RITM form so that a print friendly version can be opened.  So far I have not been able to achieve this.  

Love your script for workspace and it worked perfect!

Melissa

Melissa Bennett
Tera Expert

Nevermind .. got it!

Client = Checked

Form button = Checked

Onclick = printView()

Script:

function printView() { 
    var sysparm_table = g_form.getTableName(); 
    var sysparm_sys_id = g_form.getUniqueValue().toString(); 
    var a='https://<Your Instance>.service-now.com/';
    var view = 'Print_default_view'; //Optional if you have a specific view you want
    g_navigation.openPopup(a + sysparm_table + '.do?sys_id=' + sysparm_sys_id + '&sysparm_record_rows=1&sysparm_view=' + view + '&sysparm_record_target=' + sysparm_table + '&sysparm_record_list=ORDERBYnumber&sysparm_record_row=1&sysparm_stack=no&sysparm_force_row_count=999999999&sysparm_media=print');
}

Version history
Last update:
‎02-02-2021 10:15 PM
Updated by: