how to make a print button that works only to print from certain parts

Topan Kamil
Tera Contributor

hello master

I'm new to servicenow, so I need a way to print an event form (incident)with certain parts (Post Mortem) that have been adapted to the script, is there any reference or sample script that can help me understand this, if there is a script I would be very grateful to you for having help direct me to learn service now i just made UI action but to understand script i'm still confused please guide master, thanks in advance

find_real_file.png

5 REPLIES 5

Kieran Anson
Kilo Patron

Hi,

If you want to use the OOB print button functionality, you can create a new view with the fields you desire. You can then use a UI Action that uses this view.

The below runs in a client side UI Action

function printRecord(){
	var url = new GlideURL(g_form.getTableName() +'.do');
	url.addParam('sysparm_sysid', g_form.getUniqueValue() );
	url.addParam('sysparm_media', "print" );
	url.addParam('sysparm_view', "sp" ); //replace sp with custom view name
	
	g_navigation.open(url.getURL(), 'print_preview');
}

Otherwise, another option is using the PDF script functionality to generate a PDF record.

thank you in advance master, but why is it that when you click the print number incident button it is different, between the incident form and the print preview (incident)

what i have done
1. create a new view (export_to_pdf)


2. create ui action and call view(export_to_pdf) into ui action

why does this happen, is there a script that is lacking? if there is please help for the explanation, thank you very much

thank you in advance master, but why is it that when you click the print number incident button it is different, between the incident form and the print preview (incident)

find_real_file.png

what i have done
1. create a new view (export_to_pdf)

find_real_file.png

2. create ui action and call view(export_to_pdf) into ui action

find_real_file.png

why does this happen, is there a script that is not right? if there is please help for the explanation, thank you very much

The print preview page uses the old UI15 theme, not the new one - this can't be changed.