- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2021 01:07 AM
Hi, it is super easy to export a record as a pdf.
Right click on the header, export, pdf.
Is it possible to script that?
Can i use the ui action export?
My target is, to export the user record for a npa control.
So the user request a PDF over the SC, select the User an then the pdf is attached to the RITM or it is send by a Notification.
I need a scripted solution. It is not possible to do it manual or give read access to the regarding Records.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2021 01:28 AM
yes you can generate the PDF using client side UI action
check if this helps you; it would show UI action for user to download the PDF of the record
UI action steps
Client - checkbox True
OnClick - generatePDF()
Form Button - True
Form context menu - True
Script:
function generatePDF(){
var url = '/' + g_form.getTableName() + '.do?sys_id=' + g_form.getUniqueValue() + '&PDF';
window.open(url,"_blank");
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2021 01:22 AM
Hi
please see the following resources:
And the API can be found at https://developer.servicenow.com/dev.do#!/reference/api/quebec/server/sn_pdfgeneratorutils-namespace...
Kind regards
Maik
If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2021 01:28 AM
yes you can generate the PDF using client side UI action
check if this helps you; it would show UI action for user to download the PDF of the record
UI action steps
Client - checkbox True
OnClick - generatePDF()
Form Button - True
Form context menu - True
Script:
function generatePDF(){
var url = '/' + g_form.getTableName() + '.do?sys_id=' + g_form.getUniqueValue() + '&PDF';
window.open(url,"_blank");
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2021 11:11 PM
Hi Ankur, thank you. The client Solution is perfect.
I created a onSUbmit CLient script after the Order and close the Ritm for documentation.
2 more question.
1. can we set the DownloadName?
2. can we attach that PDF to the Ritm? Its is created on client side, so i guess not, but maybe we can do the same on the serverside?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2021 11:26 PM
Hi,
Points below
1. can we set the DownloadName? - Using the above solution you cannot customize file name
2. can we attach that PDF to the Ritm? Its is created on client side, so i guess not, but maybe we can do the same on the serverside? - you can use server side to attach PDF to record and give file name etc
refer this link
Generate PDF and attach to the record
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader