Maximum file size to convert to base64 in servicenow

Ramesh R
Tera Contributor

What is the Maximum file size to convert to base64 in servicenow? i tried with 2MB and 3MB but it is not converting to base64. Please help me in this.

21 REPLIES 21

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Ramesh,

I believe for 2MB or 3MB should be fine

for more than 5MB check this link:

https://community.servicenow.com/community?id=community_question&sys_id=6d6f7aaddbad4010d58ea345ca961977

There is some limit when it crosses 20MB; Can you try for 10MB, 15MB and 18/19MB files as well

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

i tried with 3MB but it showing empty.

var sa = new GlideSysAttachment();
var bytes = sa.getBytes(gr); //gr is my glide record object

var content64 = GlideStringUtil.base64Encode(bytes);
gs.info("Base64 Content64:" + content64);

log message: Base64 Content64:

it is giving empty output.

Hi Ramesh,

Can you share the complete script here?

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

var gliObj = new GlideRecord('sys_attachment');
gliObj.addQuery('table_name', 'dms_document_revision');
gliObj.addQuery('table_sys_id', '405a9589db764890d17be1c2ca96197a');
gliObj.query();
gs.info('count' + gliObj.getRowCount());
while (gliObj._next()) {
var sa = new GlideSysAttachment();
var bytes = sa.getBytes(gliObj);

gs.info("Bytes: " + bytes);
var size = parseInt(gliObj.size_bytes);
gs.info("Bytes: " + size);
var content64 = GlideStringUtil.base64Encode(bytes);
gs.info("Base64 Content64:" + content64);
}