Skip to content

Commit 6282ffc

Browse files
Create ConvertAttachmentToBase64.js
1 parent a3d0bc8 commit 6282ffc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* attGr is a GlideRecord from sys_attachment table */
2+
3+
function attachmentToBase64(attGr) {
4+
5+
/* constructor of GlideSysAttachment class */
6+
var gst = new GlideSysAttachment();
7+
8+
/* fetching the attachment content in bytes */
9+
var bytes = gst.getBytes(attGr);
10+
11+
/* encoding the bytes in base64 format */
12+
var base64Content = GlideStringUtil.base64Encode(bytes);
13+
14+
return base64Content;
15+
16+
}

0 commit comments

Comments
 (0)