Community Tip - You can change your system assigned username to something more personal in your community settings. X
Does anyone use rich text on the change notice with ESI sending to SAP? If so how do you handle the html tags that windchill adds to your description?
Hi,
ESI Tibco will not translate any thing. if windchill response file sending html tags, you can pass to SAP as is..
regards
GAIN Sreeni
We are using PI/PO and are being told it can not process the html tags. Are you saying sap can handle the html tags?
Hi
I don't have any idea about SAP PI/PO, but what i'm trying say, if you using ESI then it will work.
if possible share ESI response file if your using ESI services and generation XML file..
#gainsreeni
<Description><ul><li>This is a <strong>test</strong> of the <em>new </em><span style="font-size: 14px;">rich </span><u>text </u><s>feature </s>it <sub>includes </sub>as <sup>many </sup>special characters as possible<ul><li><span style="color: rgb(231,76,60);">test </span><span style="background-color: rgb(46,204,113);">line </span>2</li></ul></li></ul><div style="text-align: center;">Center</div><div style="text-align: center;">&nbsp;</div><div style="text-align: right;">Right</div></Description>
Is an example of what is being sent.
Expected out put is:
This is a test of the new rich text feature it includes as many special characters as possible
test line 2
Center
Right
Thanks,
Response data is fine..
issue with your PI/PO only.. look at it..
it is working for my customer ABBOTT with ESI Tibco and SAP only..
regards
#gainsreeni
Thanks for the insights and help!!
I know this is an old post, but https://www.ptc.com/en/support/article/CS312182 addresses this topic partially.
Per the SPR, I am told that R&D does not suggest that the extra HTML characters are removed as the downstream system(s) that would receive this information could potentially consume this formatted data.
There are two ways this can be solved:
Here is the code for copying the rich text description into the plain text attribute. As mentioned, this can be dropped into an Execute Expression robot right before the Set State Released node in the Change Notice workflow. (println statements are just for debugging - you can remove them)
if (primaryBusinessObject instanceof wt.change2.WTChangeOrder2) {
wt.change2.WTChangeOrder2 cn = (wt.change2.WTChangeOrder2)primaryBusinessObject;
String plainTextDescription = cn.getLongDescription().getPlainText();
System.out.println("The long decription formatted to plain text is: " + plainTextDescription);
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(cn, null, null, null);
obj.load("description");
if (plainTextDescription != null) {
obj.set("description", plainTextDescription);
obj.apply();
System.out.println("applied");
wt.fc.PersistenceHelper.manager.modify(cn);
System.out.println("saved (modified)");
} else {
System.out.println("plainTextDescription was null");
}
}
@BenPerry,
This is great, I took it a step further using regex to apply limited formatting so a multi-line description comes out in plaintext as multi-line
if (primaryBusinessObject instanceof wt.change2.WTChangeOrder2) {
wt.change2.WTChangeOrder2 cn = (wt.change2.WTChangeOrder2)primaryBusinessObject;
String htmlString = cn.getLongDescription().getFormattedText();
System.out.println("The long decription is: " + htmlString);
String plainTextDescription = htmlString
.replaceAll("(?i)<li[^>]*>", "\n- ") // Add a dash and a space before list items
.replaceAll("(?i)<tr[^>]*>|<td[^>]*>(?! )", "\n") // Newline before table rows and non-empty table data
.replaceAll("(?i)<p[^>]*>", "\n") // Insert newline before each paragraph tag
.replaceAll("<[^>]+>", "") // Remove all HTML tags
.replaceAll(" ", " ") // Replace HTML non-breaking spaces
.replaceAll("\n+", "\n").trim(); // Remove multiple newlines and trim whitespace
System.out.println("The long decription formatted to plain text is: " + plainTextDescription);
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(cn, null, null, null);
obj.load("description");
if (plainTextDescription != null) {
obj.set("description", plainTextDescription);
obj.apply();
System.out.println("applied");
wt.fc.PersistenceHelper.manager.modify(cn);
System.out.println("saved (modified)");
} else {
System.out.println("plainTextDescription was null");
}
}