Worknotes are displaying in HTML format
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2024 03:03 AM
Hi All,
We have done the Sentinel to ServiceNow bidirectional Integration but while updating the worknotes in Incident from Sentinel it is coming in but in HTML format but I want it to be update as plain text.
Please help me to resolve the issue.
Thanks and Regards,
Sakshi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2024 03:19 AM
You can refer below code for your reference, here we need to remove all tags from html body and then we can set the plain text to worknotes
var htmlFieldValue = '<p><span dir="ltr">App Rat Indicators :<strong>Usage Data</strong> - Data in place for 341 , T<strong>otal Cost of Ownership (TCO)</strong> - Data in place for 619 , <strong>Technical Deb</strong>t - Data in place for 121 , Integration Count - Data in place for 25, <strong>Incident Count </strong>- Data in place for 472 , <strong>Change Request Count</strong> - Data in place for 394</span></p><p> & nbsp; </p>';
var plainText = stripHTMLTags(htmlFieldValue); //stripHTMLTags function call which removes all tags
gs.info(plainText); //You can set the plainText value to worknotes in your code
function stripHTMLTags(htmlFieldValue) {
// Remove CDATA tags
var cleanedString = htmlFieldValue.replace(/<!\[CDATA\[|]]>/g, "");
// Remove HTML tags
cleanedString = cleanedString.replace(/<\/?[^>]+(>|$)/g, "");
return cleanedString;
}
This will definitely helps you to resolved your issue. Let me know in case you need to understand anything, you can DM on LinkedIn.
If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.
Best Regards,
Krushna Birla
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2024 09:46 PM
If this above solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.
Best Regards,
Krushna Birla
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2025 02:17 AM
The code would work but where would you put it to resolve the issue of the Sentinel integration updating the worknotes?
All I can think of is adding a BR to 'sys_journal_field' or related tables which does not sound like a good idea...