Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//Setting up the content of the PDF that will be generated
//It contains - Short Description, Number, Caller ID, Priority, Assignment Group and Description
var content =
'<div style="font-family: Arial, sans-serif; font-size: 14px; color:#333; padding:8px;">' +
'<h2 style="color:#0b5cab; font-weight:bold; margin-bottom:10px;">' + current.short_description + '</h2>' +
'<p><b>Number:</b> ' + current.number + '</p>' +
'<p><b>Caller:</b> ' + current.getDisplayValue('caller_id') + '</p>' +
'<p><b>Priority:</b> ' + current.getDisplayValue("priority") + '</p>' +
'<p><b>Assignment Group:</b> ' + current.getDisplayValue('assignment_group') + '</p>' +
'<p><b>Description:</b> ' + current.getDisplayValue("description") + '</p>' +
'</div>';


new sn_pdfgeneratorutils.PDFGenerationAPI().convertToPDF(content, current.sys_class_name, current.sys_id, current.number);
action.setRedirectURL(current);
21 changes: 21 additions & 0 deletions Client-Side Components/UI Actions/Generate PDF/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
This is an UI action script written on the [incident] table in ServiceNow.
This helps to generate PDF file with the current incident record details and attaches it to the same record.



UI Action Details:

Name: Attach INC Details
table: incident
Active: true
Show Update: true
Form button: true
Condition: /as per requirement/
Script: check the [generatePDFWithDetails.js] file


Output:

<img width="1149" height="648" alt="image" src="https://github.com/user-attachments/assets/4b3031fe-c39c-40cb-b642-6d21bb2bab67" />


Loading