Need to exclude additional comments history from worknote
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2024 10:06 AM
I want to display only the latest additional comment in the work note and exclude the rest of the comments' history.
I tried the below logic but not working as expected.
var inboundEmailContent = /* get the content of the inbound email */;
var currentAdditionalComments = current.additional_comments || '';
// Exclude email history, signatures, or other parts as needed
var filteredEmailContent = filterEmailContent(inboundEmailContent);
// Append the filtered inbound email content to the existing additional comments
current.additional_comments = currentAdditionalComments + '\n\n' + filteredEmailContent;
current.update();
// Function to filter out unwanted parts from the email content
function filterEmailContent(emailContent) {
// Remove lines starting with "From:", "Sent:", or "To:"
return emailContent.replace(/^From:.*$|^Sent:.*$|^To:.*$/gm, '');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2024 10:11 AM
Hi @SNOW17
What is the use case? It is like you want to remove all previous updates which is not recommended.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************