- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2025 04:33 AM
Document Template- - In ServiceNow, a Document Template is a reusable content layout that allows users to quickly generate standardised documents with pre-filled data from records or to attach any pdf required accordingly.
Step 1: Create a Document Template
All > Document Templates > All Document Templates > New
You’ll be prompted to select the type of document template you want to create:
HTML Template
An HTML Template creates documents that you can view right inside ServiceNow.
It’s great for things like emails or on-screen reports because it supports full HTML and CSS styling, so you can design it however you like.
The document stays editable and dynamic, which means you can tweak it or update it anytime.
PDF Template
A PDF Template turns that same layout into a fixed, downloadable document — perfect for things like incident reports, receipts, or official records.
Once generated, it’s locked and read-only, so no one can change it.
Think of it as the “final version” of your document, ready to print or share.
*First create one custom reference field on incident table called Document template referencing to document template table.*
Step 2 : Create the Script Include
You have three scripts here:
- IncidentAPI
- Incident API Imp l
- IncidentDocumentClientUtil
1.IncidentAPI
This script extends the functionality from another class (Incident API Imp l).
It serves as the public API class that other scripts or UI policies can call.
It doesn’t contain logic itself — it just acts as a bridge or interface that points to the implementation class.
2.Incident API Imp l
This script contains the actual business logic for incident-related operations.
The method showGenerateDocument() decides whether to show or hide the "Generate Document" button.
It checks the incident state — for example, only shows the button if the state is Resolved (6) or Closed (7).
3.IncidentDocumentClientUtil
This Script Include is client-callable (AbstractAjaxProcessor) — it can be invoked from a UI Action using GlideAjax.
It receives input parameters from the client (like selected template, incident number, and Sys ID).
It uses s n_doc.GenerateDocumentAPI() to generate a document (PDF/HTML) based on the chosen template and attaches it to the record.
Finally, it returns a success/failure message back to the client script
Step 3 : Add a “Generate Document” UI Action
- Name: Generate Document
- Table: Incident
- Action name: generate_document
- Form button: ✅ Checked
- Condition: Leave blank (or use your display logic later)
- On click: generateDocument()
Step 4: Testing
Go to the Incident table and open any incident record.
If the state is set to Closed or Resolved, you should see the “Generate Document” button.
Select a template from the custom field you added, then click the button — a PDF document will be created and automatically attached to the incident record.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Yes, we can add signatures in Document Templates in ServiceNow in a few different ways.
1. Using a Signature Image Field
We can create a field on the table with type Image or Attachment. The user uploads their signature image (PNG/JPG), and that field can then be referenced inside the document template so the signature appears automatically when the document is generated.
2. Integration with DocuSign
For more formal or legal use cases, ServiceNow can integrate with DocuSign. The document is generated from the template and sent to DocuSign for electronic signing. After the user signs it, the signed PDF is returned and attached back to the record in ServiceNow. This usually requires activating the DocuSign Spoke.
3. Using the Signature Pad Plugin
Another option is using the Signature Pad (Signature Pad plugin). This allows users to draw their signature directly on the screen. The signature is saved as an image in the record and can later be included in the generated document.
So depending on the requirement, we can use an uploaded signature image, an e-signature integration like DocuSign, or a signature pad to capture the signature directly in ServiceNow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Can we add signature to these documents ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Yes, we can add signatures in Document Templates in ServiceNow in a few different ways.
1. Using a Signature Image Field
We can create a field on the table with type Image or Attachment. The user uploads their signature image (PNG/JPG), and that field can then be referenced inside the document template so the signature appears automatically when the document is generated.
2. Integration with DocuSign
For more formal or legal use cases, ServiceNow can integrate with DocuSign. The document is generated from the template and sent to DocuSign for electronic signing. After the user signs it, the signed PDF is returned and attached back to the record in ServiceNow. This usually requires activating the DocuSign Spoke.
3. Using the Signature Pad Plugin
Another option is using the Signature Pad (Signature Pad plugin). This allows users to draw their signature directly on the screen. The signature is saved as an image in the record and can later be included in the generated document.
So depending on the requirement, we can use an uploaded signature image, an e-signature integration like DocuSign, or a signature pad to capture the signature directly in ServiceNow.
