How do you decode a base64 field?

  • 1
  • Question
  • Updated 2 years ago
I have a salesforce field of base64 type that I need to decode?  How would I do that in a custom renderer?

thanks
Photo of Jaime

Jaime

  • 1,220 Points 1k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
I think bota and atob would be the functions you would want to decode and encode base 64 strings in javascript. https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
Photo of jili@heidrick.com

jili@heidrick.com

  • 2,032 Points 2k badge 2x thumb
Hi I'm trying to use the new contentnote object. In the custom render for the content field in a list view:
value1 = arguments[1];
text = window.atob(value1);
skuid.ui.fieldRenderers['TEXTAREA'][field.mode](field,text);

In the custom render for the content field in a field editor:
value1 = arguments[1];
text = window.btoa(value1);
skuid.ui.fieldRenderers['TEXTAREA'][field.mode](field,text);

The value displays as
W29iamVjdCBPYmplY3Rd

Do you have an example for custom rendering base64 field?

Thanks.