ドキュメントテンプレートの使用:お客様の利用状況のケース
HR サービスデリバリ (HRSD) の外部でドキュメントテンプレートを使用する方法を理解します。
始める前に
必要なロール:admin
手順
- 特定のテーブル (インシデントテーブルなど) のドキュメントテンプレートを定義します。
-
ドキュメントテンプレートから PDF ドキュメントを生成するには、次の 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) -
ドキュメントテンプレートに参加者が設定されている場合は、次の API を使用して参加者のドキュメントタスクを開始します。
/** * 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) -
レコードに関連付けられているドキュメントタスクを表示するには、以下を実行します。
- レコード (インシデントレコードなど) を開きます。
- 関連リストを構成します。
スラッシュバケットが開きます。[ドキュメントタスク -> 親] を追加して [保存] します。
レコードに関連付けられたドキュメントタスクが、[ドキュメントタスク] 関連リストに表示されます。