Modify a word document when a RITM is submitted
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2023 11:29 PM
Hi All,
Can we open a word document and replace the text in the document in ServiceNow>
Please suggest.
Thanks in Advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2023 11:35 PM
Hello @Nagashree5
Use the below code related to your use case/requirement :-
var gr=new GlideRecord('sys_attachment');
gr.initialize();
gr.table_sys_id='sys_id_of_record'; //pass incident sys_id for a check
var gsa = new GlideSysAttachment();
var attachmentId = gsa.write(gr, "TestSample.doc", 'text/plain', "your text here");
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 01:56 AM
Hi @Samaksh Wani,
Thanks for the response.
The word document is getting created but seems like the file is corrupted and also here I have to replace few words in the word document to different words, is it possible to modify the doc by replacing few words.
Please suggest.
