
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2020 08:04 AM
So, I'm trying to Base64 decode a Base64 encoded string within a Script Include (server side). Of course I get "atob is not defined", so I'm wondering how to do this in ServiceNow.
I'm thinking I can use ServiceNow's "GlideRhinoHelper", but there is 0 documentation for it!
Anyone able to assist?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2020 09:08 AM
Ok, finally got it.
JSON.parse(GlideStringUtil.base64Decode(s))
So for example this Base64 encoded string:
eyJndWlkIjoiMjhmZDdiYmQtM2U2Ny00MDMwLTlhN2YtN2YzMzk1Zjc3Nzg2IiwiYWN0aW9uIjoidXBkYXRlIiwiZmllbGRzIjoiZW1haWwsbGFzdF9uYW1lIn0=
would process out to:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2020 08:22 AM
Nevermind... found it.
GlideStringUtil.base64Decode()
GlideStringUtil.base64Encode()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2020 08:41 AM
Well, this sucks... seems you can only use GlideStringUtil.base64Decode() on something that was encoded with GlideBase64.encode()
And it there is no such thing as GlideBase64.decode()
So if something was encoded with btoa('test'), GlideStringUtil.base64Decode() won't work.
So frustrating!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2020 09:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 09:29 PM
Hi xiaix,
Did you have to do anything to else after "GlideStringUtil.base64Decode() on something that was encoded with GlideBase64.encode()" to make GlideStringUtil.base64Decode() work? I'm trying to convert a base64 string (generated using CertificateEncryption.generateMac() ) into hex and GlideStringUtil.base64Decode() doesn't work.