How to remove water mark, signatures from inbound action script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi Team,
We have configured "Approve" and "Reject" buttons on Approval request notification.
When Click on "Approve"/"Reject" it redirects to Outlook and approver gives comments and send mail to servicenow.
Approve/Reject working as expected, but, I can't able to get the approval comments, which approver enter in email. It contains watermarks/signatures etc... instead of only comments. I'm using below script for the same.
Example Body: the body part of Approver email
Approver Comments: Approved. Please go Ahead.
Ref: xASDf46577869DSRT
Thanks & Regards,
Prasanna Kumar
I've tried the below codes in inbound action:
current.comments = email_body_text; OR current.comments = email_body;
OR
current.comments = email_body.approver_comments;
OR
current.comments = email_body_text.approver_comments;
The above ways comments contain watermarks/signatures etc... How can we exclude Water Marks and Signatures.
In above scenario, My required out put is "Approved. Please go Ahead." in comments.
Please provide possible solutions.
Thanks & Regards,
Prasanna Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
For watermark, refer below
For removing signature, you can refer below article
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @prasannakumard
Try using a Regex to extract only the approval comments from the reply email. You can further enhance the script as needed.
Sample regex:
var input ="Approver Comments: Approved. Please go Ahead.Ref: xASDf46577869DSRTThanks & Regards,Prasanna Kumar"; //email.body_text
var match = input.match(/^(.*?)\bRef\b/i);
if (match && match[1]) {
var result = match[1].trim();
gs.info(result);
}
Output:
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
@prasannakumard I would suggest hiding water mark not omitting.
For your question about signatures, omitting that is possible with regex or string operations but that is always risky and can break as you can lose important information while removing signatures. But it is still possible.
Please mark the answer correct/helpful accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
you will require some string manipulation to remove signature
links already shared by other members.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader