- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2024 04:34 AM
I am trying to convert the image into base 64 encoded string, can anyone help me in this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2024 06:50 PM
Hi @a41022639 ,
You can go through this link, I have already posted a script include code.
Please accept my solution and give thumbs up, if it helps you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2024 04:23 PM
HI @a41022639
I am not sure of the exact scenario you are trying to encode in-
Below is the function to convert a image into base64-
(function() {
var sysId = '6816f79cc0a8016401c5a33be04be441'; // sys_id of the user record
var tableName = 'sys_user'; // Table name
// Now update the base64Value field with this base64 string
var userRecord = new GlideRecord(tableName);
if (userRecord.get(sysId)) {
var base64Image = GlideStringUtil.base64Encode(userRecord.photo);
userRecord.setValue('base64Value', base64Image);
userRecord.update();
gs.info('Base64 value updated for user: ' + base64Image);
}
})();
Here i have taken sys_user as a table where photo is stored against a profile.
i am converting it and storing in a separate field.
If my response has resolved your query, please consider giving it a thumbs up and marking it as the correct answer!
Thanks & Regards,
Sanjay Kumar Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2024 06:50 PM
Hi @a41022639 ,
You can go through this link, I have already posted a script include code.
Please accept my solution and give thumbs up, if it helps you.