Question
· Dec 13, 2021

Preventing escaping (", &) in business rules

Hey InterSystems Community,

I noticed something interesting in regards to business rule editing. Whenever you use the Management Portal or Studio to edit a business rule, the " characters gets escaped to a ".

Which results in the following code:

As long as you are not mixing development styles - as in, sticking to only the UI or only the code, it is not a problem. But as soon as you mix both, the escaping starts to hinder readability of the rules a bit. I noticed that this is not the case with other interoperability features, like data transformations. They work perfectly fine without escaping the " characters:

And in fact, you can change the business rule to use single quotes ('), too, while preserving functionality. Just, as soon as you edit it in the UI, it gets reverted:

I've spent a bit of time working myself through the ZEN classes of the rule editor (EnsPortal.RuleEditor) to find the reason for that to maybe create a workaround for my development team, but I couldn't find anything, but I did some experiments:

  • The HTTP Post that transfers the data from the frontend Javascript/ZEN to the IRIS backend does not escape the "-characters yet
  • Using a source control hook (%Studio.Extension.Base, OnBeforeSave) is apparently too late. The "-characters are already escaped 
  • The only bit of source code that looked "suspicious" was the %CSP.TokenStream class, more precisely the QuoteHTML method?

Does anyone have an idea where the bit of code is that makes it behave this way, why it works like this and how I could potentially work around this? Any ideas would be greatly appreciated!

Discussion (0)1
Log in or sign up to continue