Generate a pdf name using UI action from catalog variables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 09:43 PM
Hi All
I have created a Button called print on the request item table so when a user clicks on it this will generate a pdf as sc_req_item(1) but now I want to replace the name with the Name of the variable from the catalog item using below script.
Script:
function exportPDF() { var sysparm_table = g_form.getTableName(); var sysparm_sys_id = g_form.getUniqueValue().toString(); var a='https://xxx.service-now.com/'; var url = a+sysparm_table + '.do?PDF&sys_id=' + sysparm_sys_id; g_navigation.openPopup(url); }
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 10:06 PM
since you are using the OOB way to generate the pdf you can't change the file name
You can use custom code for this
Check this link
Generate PDF and attach to the record
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 10:15 PM
You can try below solution, it will attach the generated PDF to your record and set the name of file as per your requirement.
Thanks
Anil Lande