- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2025 07:05 AM - edited 07-09-2025 07:09 AM
Hi All,
I am looking for an option/suggestion that, whether in ServiceNow, is it possible to generate Word document. I have a requirement that, Client has shared some pre-defined templates and in that, we need to map certain values from the record (Case table).
So by surfing in the internet, I found that, in Document Templates, we can able to achieve it by installing some plugins. I tried installing those and tried creating sample document templates, but still I am not sure what configuration am I missing, as the values are not mapping.
So if anyone worked on this and have some insights on this, please provide me the explanation and steps also if that needs to be followed, so that it will be really helpful.
Below are the things I tried from my end:
1. Created one sample word document (.docx) and inside that I have added some random paragraph along with field which needs to be mapped with Case table.
Content present in the word doc ,for example:
The Number is ${number}.
Also, I tried with multiple combinations. For eg: ${number} / {{number}} / number / {number}. But still no luck.
2. Created new document template in servicenow by selecting Word Template and attached the above word doc in the document field.
3. Tried clicking the "Parse word document" related link, but it doesn't create any. So I tried with manual mapping and here I can see couple of fields "Document Field", "Field Name" and in these fields, I provided values with multiple combinations as per above (number, {{number}}, ${number}...) and in Mapping field, I selected Number.
4. Once I added the mapping manually, I can see Preview Button appeared in the Document Template, I selected respective Case record and clicked on "Generate Preview", it generates a word document and attached in the same document template and when I check the preview doc, I dont see anything got mapped.
Whatever I entered in the word document, I can still see the same.
I know its very big message but just wanted to let you all know, what i tried. So if anyone could provide insights on this, it will be really helpful.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2025 02:55 AM
Once the document template is published whatever documents (PDF) will be generated will be based on those field mappings.
if they move that template to Draft and edit and change the mappings System cannot automatically generate new documents (PDF) with the new mappings and attach to the earlier records.
It has to be done manually or via a custom solution.
I believe I have answered your original question and subsequent question as well.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2025 02:55 AM
Once the document template is published whatever documents (PDF) will be generated will be based on those field mappings.
if they move that template to Draft and edit and change the mappings System cannot automatically generate new documents (PDF) with the new mappings and attach to the earlier records.
It has to be done manually or via a custom solution.
I believe I have answered your original question and subsequent question as well.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2025 09:40 AM
Hi @Avinash44
I recently worked on a requirement where I needed to generate an official letter (Word format) from a record in a custom table in ServiceNow. I’m sharing the full solution here in case it helps someone with a similar use case.
The best part? No scripting required – this is all done using ServiceNow's built-in Document Templates feature.
Use Case
Let’s say you have a custom table like u_request_letter where users submit request forms. You want to create a downloadable .docx letter for each record (such as approval letters, certificates, summaries, etc.).
Steps to Implement
🔹 Step 1: Activate Document Templates Plugin
Go to System Definition > Plugins
Search for: Document Templates
Activate the plugin: com.glide.document_generator
🔹 Step 2: Create a Word (.docx) Template
Open Microsoft Word
Write your letter format and use placeholders like ${user_name}, ${request_number}, etc.
Save the file as: Request_Letter_Template.docx
📝 Example content:
🔹 Step 3: Create the Document Template in ServiceNow
Go to Document Templates > Document Templates
Click New
Set the table to your custom table (e.g., u_request_letter)
Upload your .docx file
Submit the form
Open it again and click Auto-map fields
🔹 Step 4: (Optional) Add a Button to Generate the Document
To let users generate the letter directly from the form:
Go to System Definition > UI Actions
Create a new UI Action:
Table: Your custom table
Name: Generate Letter
Action type: Form Button
Script:
javascriptvar generator = new sn_docgen.DocumentGenerator(); var output = generator.generateTemplate('<YOUR_TEMPLATE_SYS_ID>', current.sys_id); action.setRedirectURL(output.url);Replace <YOUR_TEMPLATE_SYS_ID> with the actual Sys ID of your uploaded template.
Final Output
Now when you click the "Generate Letter" button on a record, ServiceNow will generate a Word document with values filled in from the record. You can also use Flow Designer to send this as an email attachment if needed.
Pro Tips
You can use dot-walking for related fields like ${caller.name}.
Make sure field names in the template match the ones in your table.
The document can also be auto-generated through Flow using the Generate Document action.
Happy building!
— Saadat Ali—
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2025 02:07 AM
Hi Ali,
I have installed the Document Template plugin and tried the above mentioned steps. I just have one query, while creating document template, which type you have selected? Is it HTML Template or Word Template?
And if it's a Word template, there it's asking a document field to upload a word document and I have uploaded the sample doc and once I submit the request, I dont see any field mapping button functioanlity which you referred. Rather I can see related link called "Parse Word Document" and if I click that, nothing is doing actaully. Then I had to manually map and in that mapping only, I have tried multiple combinations but still it is not working.
Maybe, could you check the screenshot once which I shared above, so that you will see what exaclty I am seeing in the document templates and you could assist me.