How to get the base 64 encoding of a servicenow attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2014 04:28 AM
Hi All,
I am trying to send an attachment via web service and trying to use attachment Creator message for that.So when we need to give the base64 encoding of an attachment,
how to get that ?
regards,
Debanjan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2014 04:45 AM
This is the code I have in one of our Script Includes for WSDL
It is called from a BR that has determined if the attachment needs to be sent or not
s = new SOAPMessage('xxxxx', 'update');
var sa = '';
var binData = '';
var encData = '';
gr = new GlideRecord('sys_attachment');
gr.addQuery('sys_id',this.asys_id);
gr.query();
if (gr.next()) {
s.setStringParameter('filename',gr.file_name);
s.setStringParameter('comment', 'Adding Attachment : ' + gr.file_name);
s.setStringParameter('type',gr.content_type);
sa = new GlideSysAttachment();
binData = sa.getBytes(gr);
s.setStringParameter('encData', GlideStringUtil.base64Encode(binData));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2016 04:31 AM
this might help to understand the approach of sending files via Web Service ServiceNow Attachment Files via Web Service - YouTube