Decode base64 image and add as attachment to the incident

Madhavi2
Tera Contributor

Hi All,

I am trying add a base 64 encoded attachment to the incident with below script. But it is not attaching the image.

 

var base64String = current.u_image_data;
var base64Bytes = GlideStringUtil.base64DecodeAsBytes(base64String);
var attachment = new GlideSysAttachment();
var attachmentSysId = attachment.writeBase64(current.getTableName(),current.getUniqueValue(),     'test.jpeg','image/jpeg',base64String);
 
Thanks
5 REPLIES 5

Hi Ankur,

I am trying in global scope only. 

We are attaching the data through excel.

Thanks