- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
Hi community, good day,
I am working on a requirement.
On the incident table, I need a button so that when I click that button, the record gets downloaded in PDF format. But this is not happening.
I am using this approach...
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Just realized close bracket is missing
function onClickGeneratePDF(){
window.open("/incident.do?PDF&sys_id=" + g_form.getUniqueValue()+ "&sysparm_view=default", "_blank");
}
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
you can use the easy approach shared by @palanikumar
You need not use script include then.
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
5 hours ago
@rah dev ,
Use ServiceNow PDFGenerationAPI (sn_pdfgeneratorutils.PDFGenerationAPI) on the server side to convert HTML or a Document Template into a proper PDF (not just raw text), attach it to the record, and return a download URL, then call that via Client Script or UI Action....
For example, your Script Include (or server logic) would build an HTML or template view, pass it to PDFGenerationAPI to generate the PDF, write it as an attachment, and return the sys_id or URL. The client script would still call via GlideAjax / UI Action and open the returned URL for download...Also double check that your Script Include is client callable (extends AbstractAjaxProcessor) and in the correct scope so that your client script can invoke it...
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/