Generate a Document In Flow for a Case

Justin21
Tera Contributor

Is it possible to generate a document (like a letter of employment) after a case has been submitted? 

Essentially, after the user provides details in the record producer - can that information be passed into a Letter of Employment document template and then available for the user to download from the Employee Center portal?

Is a flow needed for building something like this? Or is there a better way? 

2 REPLIES 2

Ankur Bawiskar
Tera Patron

@Justin21 

if you have already configured document template then you can use server side script to generate the document and attach to record

check my blog

Generating and Attaching Document Templates in ServiceNow to Record - Server Side 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Tanushree Maiti
Mega Patron

Hi @Justin21 

 

1. You can achieve it by running fix script/background script

 

var recordId = current.sys_id; // Sys ID of the submitted Case record
var documentTemplateId = 'YOUR_TEMPLATE_SYS_ID'; 
var pdfName = 'Letter_of_Employment.pdf';
new sn_doc.GenerateDocumentAPI().generateDocumentForTask(recordId, documentTemplateId, pdfName);

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: