<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Could you please help me with generating a Word document in ServiceNow? in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3436882#M5492</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Could you please help me with generating a Word document in ServiceNow?&lt;/STRONG&gt; I am looking for a solution similar to how PDF documents are generated. Has anyone implemented Word document generation for any record in ServiceNow? If so, I would appreciate guidance on how to configure it.&lt;/P&gt;&lt;P&gt;I want to create a UI Action in Workspace where a user can select a record and click a button to generate a Word document. We can generate PDFs, but I am not sure how to do the same for Word documents. Could you please provide the steps or a working solution?&lt;/P&gt;</description>
    <pubDate>Tue, 25 Nov 2025 07:42:56 GMT</pubDate>
    <dc:creator>KanishkaS814962</dc:creator>
    <dc:date>2025-11-25T07:42:56Z</dc:date>
    <item>
      <title>Could you please help me with generating a Word document in ServiceNow?</title>
      <link>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3436882#M5492</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Could you please help me with generating a Word document in ServiceNow?&lt;/STRONG&gt; I am looking for a solution similar to how PDF documents are generated. Has anyone implemented Word document generation for any record in ServiceNow? If so, I would appreciate guidance on how to configure it.&lt;/P&gt;&lt;P&gt;I want to create a UI Action in Workspace where a user can select a record and click a button to generate a Word document. We can generate PDFs, but I am not sure how to do the same for Word documents. Could you please provide the steps or a working solution?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2025 07:42:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3436882#M5492</guid>
      <dc:creator>KanishkaS814962</dc:creator>
      <dc:date>2025-11-25T07:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please help me with generating a Word document in ServiceNow?</title>
      <link>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3437233#M5496</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/834036"&gt;@KanishkaS814962&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what is your business requirement behind this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For DOC generation, you might need to purchase this app -&amp;nbsp;&lt;A href="https://store.servicenow.com/store/app/d80a2fa21b246a50a85b16db234bcb45" target="_self"&gt;DocGenerator&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am worried that ServiceNow can generate stricly PDF just and only. But perhaps I'm wrong...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2025 13:37:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3437233#M5496</guid>
      <dc:creator>GlideFather</dc:creator>
      <dc:date>2025-11-25T13:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please help me with generating a Word document in ServiceNow?</title>
      <link>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3437260#M5497</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/834036"&gt;@KanishkaS814962&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;there is nothing OOTB available for this&lt;/P&gt;
&lt;P&gt;there is a paid app from ServiceNow which has this capability&lt;/P&gt;
&lt;P&gt;&lt;A href="https://store.servicenow.com/store/app/6f49ebae1be06a50a85b16db234bcbad" target="_blank" rel="noopener"&gt;ServiceNow Document Designer with Word&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2025 14:11:48 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3437260#M5497</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-11-25T14:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please help me with generating a Word document in ServiceNow?</title>
      <link>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3437261#M5498</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/834036"&gt;@KanishkaS814962&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do you want to generate and add from client side (UI) or server side?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2025 14:12:23 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3437261#M5498</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-11-25T14:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please help me with generating a Word document in ServiceNow?</title>
      <link>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3439136#M5517</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/614241"&gt;@GlideFather&lt;/a&gt; Thanks for the updates. At the moment, we are looking for a custom solution. I have already reviewed the paid plugin mentioned above and discussed it with the management team, but they are not interested in a paid option. We need to implement document generation for one of our applications, so we are exploring a custom approach that can produce a document with a look and feel similar to our existing PDF generation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the approach below and it is working, but I am looking for best practices and a better solution from fellow members.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; try {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Replace field names as needed&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var html = &lt;SPAN&gt;"&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta charset='utf-8'&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;"&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; html += &lt;SPAN&gt;"&amp;lt;h2&amp;gt;Record: "&lt;/SPAN&gt; + current.getValue(&lt;SPAN&gt;'number'&lt;/SPAN&gt;) + &lt;SPAN&gt;"&amp;lt;/h2&amp;gt;"&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; html += &lt;SPAN&gt;"&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Short description:&amp;lt;/b&amp;gt; "&lt;/SPAN&gt; + &lt;SPAN&gt;GlideStringUtil&lt;/SPAN&gt;.escapeHTML(current.getValue(&lt;SPAN&gt;'short_description'&lt;/SPAN&gt;)) + &lt;SPAN&gt;"&amp;lt;/p&amp;gt;"&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; html += &lt;SPAN&gt;"&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Description:&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;"&lt;/SPAN&gt; + &lt;SPAN&gt;GlideStringUtil&lt;/SPAN&gt;.escapeHTML(current.getValue(&lt;SPAN&gt;'description'&lt;/SPAN&gt;)) + &lt;SPAN&gt;"&amp;lt;/p&amp;gt;"&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; html += &lt;SPAN&gt;"&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;"&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var fileName = &lt;SPAN&gt;"Record_"&lt;/SPAN&gt; + current.getValue(&lt;SPAN&gt;"number"&lt;/SPAN&gt;) + &lt;SPAN&gt;".doc"&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var sa = new &lt;SPAN&gt;GlideSysAttachment&lt;/SPAN&gt;();&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // write(tableRecord, fileName, contentType, data)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var attachmentSysId = sa.write(current, fileName, &lt;SPAN&gt;"application/msword"&lt;/SPAN&gt;, html);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Redirect user to the attachment download&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; action.setRedirectURL(&lt;SPAN&gt;"/sys_attachment.do?sys_id="&lt;/SPAN&gt; + attachmentSysId);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; } catch (ex) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gs.addErrorMessage(&lt;SPAN&gt;"Error creating DOC: "&lt;/SPAN&gt; + ex);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gs.error(&lt;SPAN&gt;"Export to Word failed: "&lt;/SPAN&gt; + ex);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Nov 2025 10:33:12 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3439136#M5517</guid>
      <dc:creator>KanishkaS814962</dc:creator>
      <dc:date>2025-11-27T10:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please help me with generating a Word document in ServiceNow?</title>
      <link>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3439214#M5519</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/834036"&gt;@KanishkaS814962&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you may not get exact same look and feel as that of word document when you use custom solution.&lt;/P&gt;
&lt;P&gt;You will have to rely on some external library.&lt;/P&gt;
&lt;P&gt;this is somewhat challenging.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; If my response helped, please mark it as correct &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; and close the thread &lt;span class="lia-unicode-emoji" title=":locked:"&gt;🔒&lt;/span&gt;— this helps future readers find the solution faster! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Nov 2025 11:53:21 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3439214#M5519</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-11-27T11:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please help me with generating a Word document in ServiceNow?</title>
      <link>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3439587#M5527</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/834036"&gt;@KanishkaS814962&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You can achieve this requirement by implementing a UI Action. Specifically, you will need to configure a &lt;STRONG&gt;client-side UI Action&lt;/STRONG&gt; together with a &lt;STRONG&gt;client-callable Script Include&lt;/STRONG&gt;. Both components work in coordination to generate the Word document. The implementation details and code samples are provided below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the UI Action script:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; onClick() {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; ids = g_list.getChecked(); &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// returns comma-separated sys_ids&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (!ids) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN&gt;"Please select at least one record."&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// Call script include&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; ga = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GlideAjax&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'BGHDownloadUtils'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ga.addParam(&lt;/SPAN&gt;&lt;SPAN&gt;'sysparm_name'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'downloadDoc'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ga.addParam(&lt;/SPAN&gt;&lt;SPAN&gt;'sysparm_ids'&lt;/SPAN&gt;&lt;SPAN&gt;, ids);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ga.getXML(&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt;(response) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; attId = response.responseXML.documentElement.getAttribute(&lt;/SPAN&gt;&lt;SPAN&gt;"answer"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (!attId) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN&gt;"Failed to generate document."&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// Start download&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; window.location = &lt;/SPAN&gt;&lt;SPAN&gt;"/sys_attachment.do?sys_id="&lt;/SPAN&gt;&lt;SPAN&gt; + attId;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Here is the Script Include Script:-&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;P&gt;var BGHDownloadUtils = Class.create();&lt;BR /&gt;BGHDownloadUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {&lt;/P&gt;&lt;P&gt;downloadDoc: function() {&lt;/P&gt;&lt;P&gt;var ids = this.getParameter('sysparm_ids');&lt;BR /&gt;if (!ids)&lt;BR /&gt;return "";&lt;/P&gt;&lt;P&gt;var idList = ids.split(',');&lt;/P&gt;&lt;P&gt;// This will hold the combined HTML&lt;BR /&gt;var mergedHTML = "";&lt;/P&gt;&lt;P&gt;// Loop through each selected record&lt;BR /&gt;for (var i = 0; i &amp;lt; idList.length; i++) {&lt;/P&gt;&lt;P&gt;var rec = new GlideRecord('incident'); // Change table if required&lt;BR /&gt;if (!rec.get(idList[i]))&lt;BR /&gt;continue;&lt;/P&gt;&lt;P&gt;// Build HTML content manually (NO TEMPLATE USED)&lt;BR /&gt;var html = "";&lt;/P&gt;&lt;P&gt;html += "&amp;lt;h2&amp;gt;Incident Details&amp;lt;/h2&amp;gt;";&lt;BR /&gt;html += "&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Number:&amp;lt;/b&amp;gt; " + rec.getValue("number") + "&amp;lt;/p&amp;gt;";&lt;BR /&gt;html += "&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Short Description:&amp;lt;/b&amp;gt; " + rec.getValue("short_description") + "&amp;lt;/p&amp;gt;";&lt;BR /&gt;html += "&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Description:&amp;lt;/b&amp;gt; " + rec.getValue("description") + "&amp;lt;/p&amp;gt;";&lt;BR /&gt;html += "&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Priority:&amp;lt;/b&amp;gt; " + rec.getDisplayValue("priority") + "&amp;lt;/p&amp;gt;";&lt;/P&gt;&lt;P&gt;html += "&amp;lt;br&amp;gt;&amp;lt;hr&amp;gt;&amp;lt;br&amp;gt;";&lt;/P&gt;&lt;P&gt;mergedHTML += html;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (!mergedHTML)&lt;BR /&gt;return "";&lt;/P&gt;&lt;P&gt;// File name&lt;BR /&gt;var fileName = "Selected_Records.doc";&lt;/P&gt;&lt;P&gt;// Dummy record to attach the document&lt;BR /&gt;var dummy = new GlideRecord("sys_script");&lt;BR /&gt;dummy.initialize();&lt;BR /&gt;dummy.name = "Download Holder";&lt;BR /&gt;var dummyID = dummy.insert();&lt;/P&gt;&lt;P&gt;// Attach the HTML as Word file&lt;BR /&gt;var sa = new GlideSysAttachment();&lt;BR /&gt;var attachmentID = sa.write(dummy, fileName, "application/msword", mergedHTML);&lt;/P&gt;&lt;P&gt;return attachmentID;&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;EM&gt;If my response was helpful, please mark it as the correct answer &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt; to help others in the community find the solution easily.&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 28 Nov 2025 06:07:31 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3439587#M5527</guid>
      <dc:creator>indersinghp</dc:creator>
      <dc:date>2025-11-28T06:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please help me with generating a Word document in ServiceNow?</title>
      <link>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3439657#M5529</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/834036"&gt;@KanishkaS814962&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You can achieve this requirement by implementing a UI Action. Specifically, you will need to configure a &lt;STRONG&gt;client-side UI Action&lt;/STRONG&gt; together with a &lt;STRONG&gt;client-callable Script Include&lt;/STRONG&gt;. Both components work in coordination to generate the Word document. The implementation details and code samples are provided below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the UI Action script:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; onClick() {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; ids = g_list.getChecked(); &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// returns comma-separated sys_ids&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (!ids) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN&gt;"Please select at least one record."&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// Call script include&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; ga = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GlideAjax&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'BGHDownloadUtils'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ga.addParam(&lt;/SPAN&gt;&lt;SPAN&gt;'sysparm_name'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'downloadDoc'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ga.addParam(&lt;/SPAN&gt;&lt;SPAN&gt;'sysparm_ids'&lt;/SPAN&gt;&lt;SPAN&gt;, ids);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ga.getXML(&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt;(response) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; attId = response.responseXML.documentElement.getAttribute(&lt;/SPAN&gt;&lt;SPAN&gt;"answer"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (!attId) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(&lt;/SPAN&gt;&lt;SPAN&gt;"Failed to generate document."&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;// Start download&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; window.location = &lt;/SPAN&gt;&lt;SPAN&gt;"/sys_attachment.do?sys_id="&lt;/SPAN&gt;&lt;SPAN&gt; + attId;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Here is the Script Include Script:-&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;P&gt;var BGHDownloadUtils = Class.create();&lt;BR /&gt;BGHDownloadUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {&lt;/P&gt;&lt;P&gt;downloadDoc: function() {&lt;/P&gt;&lt;P&gt;var ids = this.getParameter('sysparm_ids');&lt;BR /&gt;if (!ids)&lt;BR /&gt;return "";&lt;/P&gt;&lt;P&gt;var idList = ids.split(',');&lt;/P&gt;&lt;P&gt;// This will hold the combined HTML&lt;BR /&gt;var mergedHTML = "";&lt;/P&gt;&lt;P&gt;// Loop through each selected record&lt;BR /&gt;for (var i = 0; i &amp;lt; idList.length; i++) {&lt;/P&gt;&lt;P&gt;var rec = new GlideRecord('incident'); // Change table if required&lt;BR /&gt;if (!rec.get(idList[i]))&lt;BR /&gt;continue;&lt;/P&gt;&lt;P&gt;// Build HTML content manually (NO TEMPLATE USED)&lt;BR /&gt;var html = "";&lt;/P&gt;&lt;P&gt;html += "&amp;lt;h2&amp;gt;Incident Details&amp;lt;/h2&amp;gt;";&lt;BR /&gt;html += "&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Number:&amp;lt;/b&amp;gt; " + rec.getValue("number") + "&amp;lt;/p&amp;gt;";&lt;BR /&gt;html += "&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Short Description:&amp;lt;/b&amp;gt; " + rec.getValue("short_description") + "&amp;lt;/p&amp;gt;";&lt;BR /&gt;html += "&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Description:&amp;lt;/b&amp;gt; " + rec.getValue("description") + "&amp;lt;/p&amp;gt;";&lt;BR /&gt;html += "&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;Priority:&amp;lt;/b&amp;gt; " + rec.getDisplayValue("priority") + "&amp;lt;/p&amp;gt;";&lt;/P&gt;&lt;P&gt;html += "&amp;lt;br&amp;gt;&amp;lt;hr&amp;gt;&amp;lt;br&amp;gt;";&lt;/P&gt;&lt;P&gt;mergedHTML += html;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if (!mergedHTML)&lt;BR /&gt;return "";&lt;/P&gt;&lt;P&gt;// File name&lt;BR /&gt;var fileName = "Selected_Records.doc";&lt;/P&gt;&lt;P&gt;// Dummy record to attach the document&lt;BR /&gt;var dummy = new GlideRecord("sys_script");&lt;BR /&gt;dummy.initialize();&lt;BR /&gt;dummy.name = "Download Holder";&lt;BR /&gt;var dummyID = dummy.insert();&lt;/P&gt;&lt;P&gt;// Attach the HTML as Word file&lt;BR /&gt;var sa = new GlideSysAttachment();&lt;BR /&gt;var attachmentID = sa.write(dummy, fileName, "application/msword", mergedHTML);&lt;/P&gt;&lt;P&gt;return attachmentID;&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;EM&gt;If my response was helpful, please mark it as the correct answer &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt; to help others in the community find the solution easily.&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 28 Nov 2025 08:16:31 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3439657#M5529</guid>
      <dc:creator>indersinghp</dc:creator>
      <dc:date>2025-11-28T08:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Could you please help me with generating a Word document in ServiceNow?</title>
      <link>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3501252#M6225</link>
      <description>&lt;P&gt;What’s implemented in the accepted solution is essentially HTML being exported as a Word file (.doc with application/msword). That can work as a workaround, but it’s not true Word document generation (.docx), so matching real Word templates with headers, footers, styling and layouts can become difficult.&lt;/P&gt;&lt;P&gt;In practice teams usually either generate PDFs using Document Templates, or use a document generation solution designed for Word templates when .docx output is required (for example apps from the ServiceNow Store like Office Templater).&lt;/P&gt;&lt;P&gt;The HTML approach can work for simple exports, but it tends to hit limitations once the document formatting becomes more complex.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2026 10:00:57 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/could-you-please-help-me-with-generating-a-word-document-in/m-p/3501252#M6225</guid>
      <dc:creator>Florisvmuijen</dc:creator>
      <dc:date>2026-03-04T10:00:57Z</dc:date>
    </item>
  </channel>
</rss>

