Need to generate a word document letter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2023 11:33 AM
Hi,
I have a requirement where need to generate a Word format letter based on a record. We are using a custom table to record requests created by the users. The letter will kind of like a official letter template as well. Is there any out of box feature which can be used to achieve the requirement? or any word doc generator using script
Thank you
Raju

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2023 06:55 PM
Hi,
I don't believe there's a "Word" doc generator, but you can create a PDF, XML, txt document, but that's about it.
There may be an app on the SN store that does it, but not out of the box and provided by ServiceNow.
Please mark reply as Helpful/Accept Solution, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 10:04 AM - edited 07-25-2023 10:17 AM
There is an App in ServiceNow Store (link below) that can help meet your requirement.
Also, there is an Idea already submitted in the past (click here) for the same requirement and currently it is under review by the Product team
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2025 09:16 AM
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:
var 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.
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 —