Hello, Andrew and thanks for responding.
My objective is to preserve the current resolution summary as a Note before resetting it to a blank, in a Script that will be run from a Rule when the Status becomes Active - the best indicator of ticket re-opening that I can find.
In essence:
incident.addNote("Ticket reopened. Previous Resolution Summary: {}".format(incident.resolution_summary.content))
But the content of my new Note contains the markup tags from the Resolution Summary:
Ticket reopened. Previous Resolution Summary: <div class="rte"><div>A possible resolution summary here...</div></div>
So I already used incident.resolution_summary.content and also tried incident.resolution_summary["content"] but these output the content inclusive of Tags.
I tried helper.createPlainText and this does not appear to help - I am unsure if it is needed for addNote and more significantly it also appears to pass through the tags unchanged.
As I said, in an open Python environment, the html2text library would support the tag stripping I need to do but does not seem to be available in the internal, jython scripting environment provided within Resilient - so I am looking for an alternative.
Best regards
------------------------------
Edwin Bolton
------------------------------
Original Message:
Sent: Tue April 02, 2019 03:46 PM
From: Andrew Wadsworth
Subject: How to extract plaintext from HTML in Script?
Hello Edwin,
You can access the content of the "resolution_summary" field by adding "content" when referencing it.
resolution_summary_content = incident.resolution_summary.contentresolution_summary_content = helper.createPlainText(incident.resolution_summary.content)
Is this what you were looking for?
------------------------------
Andrew Wadsworth
------------------------------