Convert Text to Base64 Invocable Flow Action

Convert Text to Base64 Invocable Flow Action

Created by Eric Smith


This Post was most recently updated on: 4/7/24
Current Version: 1.0.0


Recently I was trying to convert a JavaScript button from Salesforce Classic to Lightning that was designed to take the user to an external link for the DocuWare application.

JavaScript Button

window.open(‘https://ami.docuware.cloud:443/DocuWare/Platform/WebClient/3024/Integration?p=RLV&rl=98c8d544-9b8a-48f0-b8a7-c8287d509e5f&fc=3f857eb7-7752-4aea-afdf-5c29a5843515&q=’+btoa(‘[FIELD_10] = “{!Case.CaseNumber}”‘));

Normally, for this type of link, I like to create a Screen Flow with a custom button and the Navigate Everywhere component and use a Text Template to define the URL to navigate to.

This project was a bit trickier because the button was referencing a deprecated JavaScript function (btoa) that’s designed to encode a String as a Base64 representation.

There is no standard function in Flow that will handle this type of conversion so I created a new Invocable Flow Action that will convert any Text to Base64.  With this new action I was able to create my Text Template URL for the navigation action.

My input to the ConvertTextToBase64 action was a text template which identified the string I needed to convert.

ttCaseNumber

[FIELD_10] = “{!recordId.CaseNumber}”

The URL text template used as the input to the Navigate Everywhere action was then able to reference the output of the ConvertTextToBase64 action.

ttButton1URL

https://ami.docuware.cloud:443/DocuWare/Platform/WebClient/3024/Integration?p=RLV&rl=98c8d544-9b8a-48f0-b8a7-c8287d509e5f&fc=3f857eb7-7752-4aea-afdf-5c29a5843515&q={!Convert_to_Base64.base64Output}


Attributes

AttributeTypeNotes
INPUT
Text Value for ConversionStringThe text to convert
OUTPUT
Base64 ValueStringThe converted Base64 value

Installation

Production or Developer Version 1.0.0

Sandbox Version 1.0.0


Release Notes

4/7/24 – Eric Smith – v1.0.0
Initial Release


View Source

Source Code