Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

HRSD PDF Attachment

Mahitha Sompall
Tera Contributor

Hi,

 

I have requirement to generate PDF and assign it to the HR Case and update the work notes
When I submit the case using OOB "Employee Verification Letter" in ESC portal. I need to generate and attach a PDF to the case along with the work notes update.

PDF format must be taken from the "Employment Verification Letter in Canada" HR Document template table(sn_hr_core_document_template) by filling the user details who submitted the request.

Can some one help me with the solution on how to achieve this requirement?

Thank you 

 

1 REPLY 1

Shruti
Giga Sage
Giga Sage

Hi,

 

1. Write after business rule when HR service employment verification letter

 var templateSysId = 'f167b707b78010101cadbc78ee11a9e1'; // sysid of Employment Verification Letter in Canada template
    try {
        var pdfName = 'Employment verification letter -'+current.subject_person.name;
        var pdfSysId = new sn_doc.GenerateDocumentAPI().generateDocumentForTask(current.getUniqueValue(), templateSysId, pdfName);
    } catch (e) {
        gs.info("Error message: " + e.message);
    }
 
2. Update worknotes from record producer (Employment Verification Letter) script
current.work_notes = "PDF Attached";