Remove Watermark from email body of incoming emails

Developer3
Tera Expert

We get emails from third party vendor servicenow instance to my client instance related to vendor incident and service requests. As soon as the email hits the client instance, a call record has to be created. I configured an inbound email action for this but the incoming vendor email has watermark because of this my inbound action is not triggered and the email is getting ignored. Could anyone please let me know the script to remove watermark from email body.

I referred this post: https://community.servicenow.com/community?id=community_question&sys_id=bb064b61db1cdbc01dcaf3231f9619a6 but I am not sure on the code of how to remove the watermark from email body.

So any scripting help on this is really appreciated.

1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron
Mega Patron

Hi,

 

You can try below (untested) a business rule that runs before insert/update on sys_email table.

When to Run: Required conditions or recipient list to make it specific. Else it will run for all mail that are received.

Suppose, Subject contains ABC

Script:

(function executeRule(current, previous /*null when async*/ ) {

    var getwatermark = new GlideRecord('sys_email');
    getwatermark.query();
    if (getwatermark.next()) {
        var bodyhastext = getwatermark.body;
        bodyhastext = bodyhastext.replace(/MSG0042550/g, '');//Suppose my watermark is of form :  //Ref:MSG0042550 so it replaces it with empty
        getwatermark.body = bodyhastext;
        getwatermark.update();

    }

    //Ref:MSG0042550

})(current, previous);

 

You can use your own logic as per your watermark text. In case you can also use split or substring methods for removing watermark,

Note: This has high impact on the performance of system

View solution in original post

9 REPLIES 9

MrMuhammad
Giga Sage

Have you tried below?

Omit an email notification watermark | Servicenow Docs

 

Regards,
Muhammad

mr18
Tera Guru
Tera Guru

Set the 'Omit Watermark field to true in the notification

find_real_file.png

Developer3
Tera Expert

Hi Both,

"Omit watermark" is for outgoing notifications. I am asking about inbound emails