Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 02:52 AM
Hi,
I am writing a background script. From that script Can I create a new word document and that document should be attached to a record through background script.
Solved! Go to Solution.
1 ACCEPTED SOLUTION

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 03:05 AM
Hi Sushmita,
You can try something as below.
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");
Once done go to sys_attachment table & check for the file TestSample
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 03:05 AM
Hi Sushmita,
You can try something as below.
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");
Once done go to sys_attachment table & check for the file TestSample