---
sourceDocument: Australia Employee Service Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/de-DE/employee-service-management

 Release :

    - australia

ft:locale :

    - de-DE

ft:publication_title :

    - Australia Employee Service Management

ft:clusterId :

    - emplsm

bundleId :

    - emplsm

workflow :

    - Employee


---

# Using Document Templates: Custom use case

# Using Document Templates: Custom use case {#ariaid-title1}

* Freigeben Version: Australia
* 
* Aktualisiert 12. März 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 Minute Lesedauer

Understand how to use Document Templates outside of HR Service Delivery.

## Vorbereitungen

Role required: admin

## Prozedur

1. Define a document template for a given table, for example, Incident table.
2. To generate a PDF document from a document template, use the following API:  

       /**
       * Description: Method to generate a PDF from a document template.
       * @param {GlideRecord} recordId (GlideRecord of task table)
       * @param {documentTemplateId} docTemplateId (sysId of document template)
       * @param {String} pdfName name of generated pdf (Optional, if not passed then it will be taken from template name)
       * @return {sysId} (sysId of the attachment)
       */
       new sn_doc.GenerateDocumentAPI().generateDocumentForTask(recordId, documentTemplateId, pdfName)

3. If participants are configured for the document template, use the following API to initiate document tasks for participants:  

       /**
       * Description: Method to prefill document with mapped values and attach it to record table.
       * @param {GlideRecord} taskGr (GlideRecord of task table)
       * @param {String} htmlBody html body of document (Optional, if not passed then it will be generated from template for html template)
       * @param {SysId} docTemplateId (sysId of document template)
       * @param {String} generatedPdfName name of generated pdf (Optional, if not passed then it will be taken from template name)
       * @param {String} documentId (word template attachment sysId) (Only for word templates)
       * @return {boolean} true/false
       */
       new sn_doc.GenerateDocumentAPI().initiateDocumentTasks(taskGr, htmlBody, docTemplateId, generatedPdfName, documentId)

4. To view the document tasks that are associated to a record:  
   1. Open the record, for example, an incident record.
   2. Configure the related lists.

      A slushbucket opens. Add Document Task -\> Parent and Save.
      Document tasks associated to the record are displayed in Document tasks related list.

{#doc-temp-gen__ol_gz5_sjz_zyb}
**Zugehörige Konzepte**   

* [Using Document Templates: HR Service Delivery](https://servicenow-prod.fluidtopics.net/Iqy8sBMm2zdW0jz46qkzkw "Learn how to use Document Templates along with the HR Service Delivery application.")  
**Zugehörige Tasks**   

* [Working on a document task](https://servicenow-prod.fluidtopics.net/fwk6lvwxiGcUCz9Qksu6Mw "Complete your document tasks from Employee Center.")
* [Using Guided Tours in Document Templates](https://servicenow-prod.fluidtopics.net/__C~SPmXChr~TBKomjqAKA "Use Guided Tours in Document Templates to get instructions on how to create a document template.")

