IBM Support

An Automation Script to Address an Unusual (and Hopefully Rare) Text Truncation Problem when Creating a Communication

Technical Blog Post


Abstract

An Automation Script to Address an Unusual (and Hopefully Rare) Text Truncation Problem when Creating a Communication

Body

There is a rich text framework design gap in how entity characters are handled (encoded / decoded) behind the scenes that results in text truncation when a less than symbol ( < )  is present in a non-rich text field that's pulled into the communication RTE via a variable.  This blog article will present a work around for this behavior.  We'll set up the problem and the solution side-by-side.  As with anything presented in these blogs, refine your approach in a test environment before rolling out to production.

 

At the ticket level, I created 2 persistent attributes TEST1 and TEST2.  Make sure you turn admin mode off when complete as this will prevent scripting from picking up events.  If you don't see your script firing, check this ---  I learn the hard way so you don't have to!

 

In the application designer, I added these new fields to the SR application.  TEST2 doesn't really need to be visible if you push the "I believe." button. Create an attribute launch point on TEST1 with the script below, creating variable TEST1 pointing to TEST1 as Launch Point Attribute.  The script will call the UI Framework's HTML encode() method on TEST1 and set it's value to TEST2.  

 

Script:

from psdi.util import HTML
mbo.setValue("TEST2", HTML.encode(TEST1))

 

To test, create a comm template on SR which pulls in :TEST1 and :TEST2.  
e.g.
test1 = :test1
test2 = :test2

 

Test1 will show the current behavior and test2 should work fine.

 

Create an SR, populate TEST1 with something like x < 8 and when it's validated upon tab out or save the script will fire and populate TEST2 with x &lt; 8 (encoded incarnation of x < 8).   This field is now in a state that it can be pulled into the RT field.  Send a communication with the template and there will be no truncation on the test2 line in the email.

 

image

 

 

 


 

[{"Business Unit":{"code":"BU005","label":"IoT"}, "Product":{"code":"SSLKT6","label":"Maximo Asset Management"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":""}]

UID

ibm11131801