Skip to Main Content

Escape APEX Substitution Strings

User_WM015Apr 11 2022 — edited Apr 11 2022

What is the best way to escape APEX Substitution Strings, that they didn't get replaced during the serverside processing?
I tried to setup a Template for apex.util.applyTemplate inside the per page Javascript areas. The problem is that all placeholders ("&VARNAME.") get replaced serverside and therefore can't get replaced by apex.util.applyTemplate with the current clientside value.
So how can I tell APEX to not replace them serverside?
I have found a dirty solution to this problem by inserting a dummy substitution inside the real substitution. Like this "&&_.VARNAME.". APEX then just replace the inner substitution with an empty string and there the real substitution is correct clientside. But it is a dirty solution because whenever the dummy substitution gets set with a value the real substitution gets corrupted.

Post Details
Added on Apr 11 2022