function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amber090Amber090 

decode base64 from SF field

We have event monitoring data being loaded into a custom object and would like to decode the base64 string detailing what the event log is tracking.  Can I do this in an apex class?  What will I need to do?
pconpcon
You simply call the EncodingUtils.base64decode method [1].
 
Bob blobDecode = EncodingUtils.base64decode(base64String);
String decodedString = blobDecode.toString();

You can also read more about it here [2]

[1] https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_encodingUtil.htm#apex_System_EncodingUtil_base64Decode
[2] https://help.salesforce.com/apex/HTViewSolution?urlname=How-do-you-convert-a-Blob-to-string-1327108626373&language=en_US (https://help.salesforce.com/apex/HTViewSolution?urlname=How-do-you-convert-a-Blob-to-string-1327108626373&language=en_US)