Document generation methods
A PDF document can be generated automatically, manually, or by using an API.
Automatically
A PDF document is automatically added as an attachment to the case when:
- The configured template is selected on the HR template of a service.
- The Automatically Initiate Document tasks case option is selected on the HR service of a case.
- The state of the HR case is changed to work in progress.
- The document tasks of all the participants are complete.
Manually
A PDF document can be generated manually using the Generate option on the Preview Document option on the case.
API
The following API generates and attaches the document to the target record that is passed
to the
API.
//recordId - Sys ID of the target record. This record must be from the table defined in the document template.
//documentTemplateId - Sys ID of the document template to use for pdf generation.
//pdfName - Name of the pdf generated
new sn_doc.GenerateDocumentAPI().generateDocumentForTask(recordId, documentTemplateId, pdfName);
Note:
If
your table is caller restricted, calling this API may generate RCA records from components
in the Document Templates scope to your table. You must allow them.