Need to generate Word Document

Avinash44
Tera Contributor

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.

 

1 ACCEPTED SOLUTION

@Avinash44 

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.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

11 REPLIES 11

M_48
Tera Contributor

the plugin you mentioned doesn't exists
The field you mentioned for the document templates also doesn't exists

Florisvmuijen
Tera Contributor

Hi Avinash,

 

Based on what you described, this does not seem to be a configuration issue on your side.

 

The standard ServiceNow Document Templates capability is mainly designed for PDF generation, and support for generating Word (.docx) documents directly from record data is very limited and inconsistent. That is why placeholders such as ${number} are not being mapped.

 

In most implementations there are three common approaches:

1. Use Document Templates for PDF output
This is the native approach supported by the platform.

2. Build a custom solution
Some organizations create a scripted solution that reads a template and injects field values. However this requires maintenance and often becomes fragile over time.

3. Use a dedicated ServiceNow Store application
There are applications specifically designed to generate Word/PDF documents from ServiceNow records using Word templates with field mappings (for example Office Templater).

 

Also note that if the client updates the template later, previously generated documents will not automatically be regenerated unless additional logic is implemented.

 

So the behavior you are seeing is expected with the standard Document Template functionality. Hope this helps.