Able to generate PDF by using UI action attached to the same record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2023 07:09 AM
Hi please help me out below
By using below UI action able to generate PDF and attached to the same incident record,
but attached pdf file not open, getting like below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2023 07:22 AM
which script are you using to generate the pdf?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2023 07:27 AM
Hi Ankur,
please find below script
var gr=new GlideRecord('incident');
if(gr.get('current.sys_id'))
{
var pdfconverter = new global.GlideHTMLToPConverter();
var htmlContent = '<html><body><h1>Incident Details</h1><p>Incident number: '+ incidentnumber +' < /p></body></html>';
var pdfDocument = pdfConverter.convert();
var attachment = new global.GlideSysAttachment();
attachment.write(gr, 'incident', 'PDF Attachment', 'application/pdf', pdfDocument);
gs.info('PDF generated and attached to incident:' +incidentNumber);
}
else{
gs.error('Incident record not found');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2023 07:51 AM
are you writing this script from scope?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2023 07:57 AM