how to create attachment excel record in servicenow using script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2024 02:16 AM
hello,
Urgent help need
I have a updated excel that i want to attach to attachment record using script because kb article is published.
var attachment = new GlideSysAttachment();
//set up inputs
var rec = new GlideRecord('kb_knowledge');
rec.get('sys_id');
var fileName = 'abc.xls';
var contentType = 'application/vnd.ms-excel';
var content = '';
var agr = attachment.write(rec, fileName, contentType,content);
gs.info('The attachment sys_id is: ' + agr);
Please accept the solution /mark this response as correct or helpful if it assisted you with your question.
Regards,
Animesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2024 02:23 AM
var attachment = new GlideSysAttachment();
var rec = new GlideRecord('kb_knowledge');
rec.get('sys_id_of_the_kb_article');
var fileName = 'abc.xls';
var contentType = 'application/vnd.ms-excel';
var content = '';
var attachmentSysId = attachment.write(rec, fileName, contentType, content);
gs.info('The attachment sys_id is: ' + attachmentSysId);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2024 02:32 AM
?
i think you copy pasted my code, this is not working.!!
this code is already tried by me
Please accept the solution /mark this response as correct or helpful if it assisted you with your question.
Regards,
Animesh