- 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
‎12-13-2022 10:51 PM
This above solution works fine, but just a small modification is necessary for this to run on latest versions.
"top" needs be added before window.open, so now updated code will be :
function generatePDF(){
var url = '/' + g_form.getTableName() + '.do?sys_id=' + g_form.getUniqueValue() + '&PDF';
top.window.open(url,"_blank");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2023 12:50 AM
Hi @Ankur Bawiskar ,
Could you please convert the script to the server-side one? I need to export record PDF triggered by Business Rule.
Best Regards,
Aki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2023 11:36 PM
Hi, maybe this helps.
it is not a BR but a Workflow Script Action:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2025 04:53 AM
Hello Ankur, script in the solution is not working for me. When I click the UI action it is doing nothing. can you please assist me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2025 06:03 AM
hi can you log the Result before you call top.window.open(url,"_blank").
what is the log result of the URL Variable
Is the UI Action Client-callable?