Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 01:24 AM
The preview function is designed to open the generated PDF in a new window or tab. You can achieve the desired preview functionality by generating a PDF with the prefillPdf function and then opening that PDF with the preview function.
var wfa_caseID = '607e03320b30220097432da0d5673a23';
var pdfTemplateSysID = '73f2114b83001210027cad20ceaad3d8'; //sn_hr_core_pdf_template
// Generate the PDF draft
var draftDocSysID = new sn_hr_core.hr_PdfUtils().prefillPdf(pdfTemplateSysID, false, wfa_caseID, 'sn_hr_core_case_workforce_admin', wfa_caseID);
// Retrieve the PDF attachment
var grAttachment = new GlideRecord('sys_attachment');
grAttachment.get(draftDocSysID);
// Preview the PDF
new sn_hr_core.hr_PdfUtils().preview(grAttachment.sys_id);
action.setRedirectURL(current);