Send Offer letter pdf attachment in notification

JohnnySnow
Kilo Sage

Hi Team,

 

In our flow we have the requirement of sending the offer letter in email to the employee. High level process is as follows:

1. Manager raise request.

2. Approver approves

3. HR team gets an HR task to populate few fields (this we are doing through Employee forms), these fields need to be put into the offer letter.

4. Once 3 step is over, a notification & a task is generated for the employee (a task of e-signature type). 

 

Now  post step3 we want to generate the offer letter pdf and send this to the employee. 

 

I'm not sure how to achieve it.

 

One way, I figured could be to use 

new sn_doc.GenerateDocumentAPI().generateDocumentForTask(recordId, documentTemplateId, pdfName);

to generate the pdf, but not sure how to call this in the flow designer.

 

If there are better ways to achieve this please do let me know. 

Thanks
Johnny

Please mark this response as correct or helpful if it assisted you with your question.
10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

@JohnnySnow 

you can use custom flow action and write inside the flow.

pass the correct inputs to that flow action and then use the above script

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@JohnnySnow 

Did you try the above point?

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

Amit Gujarathi
Giga Sage
Giga Sage

HI @JohnnySnow ,
I trust you are doing great.

  1. Create a document template: First, create a document template in ServiceNow that contains the offer letter format. This template should include placeholders for the fields that need to be populated by the HR team.

  2. Configure the Flow Designer: In the Flow Designer, set up the flow to perform the following steps:

    a. Manager raises a request.

    b. Approver approves the request.

    c. HR team receives an HR task to populate the required fields using Employee forms.

    d. After the HR task is completed, generate a notification and an e-signature task for the employee.

    e. Add a script action in the flow to generate the offer letter PDF using the sn_doc.GenerateDocumentAPI().generateDocumentForTask(recordId, documentTemplateId, pdfName) method. Replace recordId with the appropriate task record ID, documentTemplateId with the ID of the document template created in step 1, and pdfName with the desired name for the generated PDF file.

  3. Send the offer letter PDF: Once the offer letter PDF is generated, you can send it to the employee via email. You can use the ServiceNow email functionality to attach the generated PDF to an email notification and send it to the employee's email address.


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



@Amit Gujarathi I tried it, but sn_doc.GenerateDocumentAPI().generateDocumentForTask(recordId, documentTemplateId, pdfName)  doesn't seem to be working... 

JohnnySnow_0-1687945238266.png

 

Thanks
Johnny

Please mark this response as correct or helpful if it assisted you with your question.