The CreatorCon Call for Content is officially open! Get started here.

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

prasannakumard
Tera Guru

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

 

4 REPLIES 4

Bhuvan
Mega Patron

@prasannakumard 

 

For watermark, refer below

 

https://www.servicenow.com/docs/bundle/zurich-platform-administration/page/administer/notification/t...

 

For removing signature, you can refer below article

 

https://www.servicenow.com/community/servicenow-ai-platform-articles/remove-email-signatures-from-in...

 

If this helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

J Siva
Kilo Patron
Kilo Patron

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:

JSiva_0-1759488132822.png

Regards,
Siva

RaghavSh
Kilo Patron

@prasannakumard I would suggest hiding water mark not omitting.

 

refer :https://www.servicenow.com/docs/bundle/xanadu-platform-administration/page/administer/notification/t... 

 

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.


Raghav
MVP 2023
LinkedIn

Ankur Bawiskar
Tera Patron
Tera Patron

@prasannakumard 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader