Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

GlideSysAttachment.write() not able to make .docx MIME type

DJ Wolfson
Mega Sage

I currently have a Script Include that is create an HTML object that I am then using GlideSysAttachment.write() to create a .doc file, however we would prefer to make a .docx however so far our efforts haven't worked.

 

I've created a small example of what we're currently doing to make the .doc file so that is may help with finding a solution. I've left the meta line in because I think something about it may lead to a solution:

var html = '<html><head>';
html += '<meta http-equiv="content-type" content="text/html" charset="utf-8">';
html += '</head><body></body></html>';

var gsa = GlideSysAttachment();
var fileName = 'file.doc'
gsa.write(current, fileName, 'application/msword', html);

 Below is what we've tried to make the html into a .docx and currently causes an issue when trying to open the outputted file:

var html = '<html><head>';
html += '<meta http-equiv="content-type" content="text/html" charset="utf-8">';
html += '</head><body></body></html>';

var gsa = GlideSysAttachment();
var fileName = 'file.docx'
gsa.write(current, fileName, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', html);
1 ACCEPTED SOLUTION

Bert_c1
Kilo Patron

Hi DJ,

 

I suggest you create a Support Case to see if the Content Type you have is supported by the platform.

View solution in original post

2 REPLIES 2

Bert_c1
Kilo Patron

Hi DJ,

 

I suggest you create a Support Case to see if the Content Type you have is supported by the platform.

I followed up through Support and was suggested to make an idea portal post... Here's the link: https://support.servicenow.com/ideas?id=view_idea&sysparm_idea_id=244c2d48470cf9102c31b98a436d4387&s...