Support Article
Source code changes after check in in email treatment
SA-26376
Summary
The source code in rules that use a rich text editor control such as Paragraphs, and Email Treatment rules in Pega Marketing get corrupted when switching between regular or source mode or when saving and reopening the rule.
For example using the code below which uses a Pega reference tag to dynamically set the href attribute for a link:
<a id="ShowInBrowserLink" href='<pega:reference name=".myPage.myURL" format ="Scalar"/>'>Link Text</a>
Entering this as source and switching between regular and source mode changes the code to include encoded characters. Previewing the rule if this is saved returns an error.
<a id="ShowInBrowserLink" data-cke-saved-href="<pega:reference format="Scalar" name=" .mypage.myurl">" href="<pega:reference format="Scalar" name=".myPage.myURL"></pega:reference></pega:reference>
Error Messages
If the rule is previewed then an error similar to the following occurred in this particular case:
Section 'myTestEmailTreatment' execution error on page 'pyTempPage' of class 'PegaMKT-Work-Offer'. : String index out of range: 10
Steps to Reproduce
1. Create an email treatment or paragraph rule and switch to source mode.
2. Insert code similar to the above example.
3. Save and check in the rule and reopen, or switch to regular mode and back to source code and save.
4. Observe that the source code has become corrupt.
5. Try to see the preview of the email treatment from the action button.
Root Cause
The root cause of this problem is a defect in Pegasystems’ code/rules. The newer version of Rich Text Editor introduced in Pega 7.1.7 to allow cross browser editing of these rules has limited capabilities. This is a work in progress.
Resolution
When using code that contains quotes within quotes, use double quotes for the parent, and single quotes for the quoted content.
Instead of this:
<a id="ShowInBrowserLink" href='<pega:reference name=".myPage.myURL" format ="Scalar"/>'>Link Text</a>
Use this:
<a id="ShowInBrowserLink" href="<pega:reference name='.myPage.myURL' format ='Scalar'/>">Link Text</a>
Published August 10, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.