how to make a print button that works only to print from certain parts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 12:14 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 01:40 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 02:10 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 02:13 AM
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 not right? if there is please help for the explanation, thank you very much

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2022 04:00 AM
The print preview page uses the old UI15 theme, not the new one - this can't be changed.