0

Question: Is it possible to compress and decompress(or encoding/decoding) a string(or a large JSON) within an Aura component that has to be passed via URL parameters using Salesforce standard libraries (EncodingUtil class) ?

Scenario: I have an Lightning Aura comp on an object detail page that contains few weblinks. Clicking on any of these links would open a subtab (using WorkspaceAPI) where I am setting Pagereference.State value with some values from the parent component. As our application is growing with more data elements, so does the Pagereference.State. To reduce the overall State parameters, I am trying to explore ways to decrease the length of the parameters to hold same data, but transfer in compressed approach.

Findings: In my research, we would need some JS libraries to do the heavy lifting on the decoding/encoding aspect. But, these could pose some security concerns as we would be relying on some external sources.

Any recommendations are welcome.

1 Answer 1

0

EncodingUtil doesn't have any kind of compression features. Compression in Apex is usually accomplished via third-party code, such as Zippex. Client-side compression can be achieved with something like lz-string. Note that in Salesforce, code hosted off-platform is forbidden in Aura and LWC; you would instead save the code as a Static Resource or as a component library in Aura or LWC. At no point can you rely on external resources outside your control, so there is zero security risk.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .