Able to generate PDF by using UI action attached to the same record

Brahmi Pandla
Tera Guru

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 

 

 

BrahmiPandla_0-1683554927713.png

 

 

 

 

 

 

 

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

@Brahmi Pandla 

which script are you using to generate the pdf?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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');
}

@Brahmi Pandla 

are you writing this script from scope?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar   No,

 

Global only