Difficulty removing trailing text from emails

mjl
Kilo Contributor

Hi - I am wanting to remove our standard disclaimer from the foot of all inbound emails when created as incidents/cases:

 DISCLAIMER: This email, together with any attachments, is for the exclusive and confidential use of the addressee(s) and may contain legally privileged information. Any other distribution, use or reproduction without the sender's prior consent is unauthorised and strictly prohibited...

I've read around and can see where to add an entry (e.g. https://community.servicenow.com/community?id=community_question&sys_id=c71f7e29db58dbc01dcaf3231f96... )

However, when I put in the first part of the disclaimer into the "Discard everything below this text if found in a reply body (comma separated, case sensitive)" section, it doesn't work for me.

Does anyone know how it actually functions? Or am I missing something really important?

1 ACCEPTED SOLUTION

Hardik Benani
Mega Sage
Mega Sage

Yes this will only work for reply emails, If you want to make it work with new inbound, you will have to manage that in the Inbound Email action by replacing the description using below:

current.description=email.body_text.replace(/<your text>+.*/, '');

 

This does seem to work, however as it states it only ignores anything below this lines: So I had an email content as below:

 find_real_file.png

 

Email received as below, you won't see it truncated it in email logs.

find_real_file.png

And finally the email property:

find_real_file.png

So I think you just need to arrange the newlines characters.

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.

View solution in original post

4 REPLIES 4

Matthew Glenn
Kilo Sage

This property only applies to reply emails and won't work on new inbound emails. Can you confirm if it doesn't work specifically against replies?

Hardik Benani
Mega Sage
Mega Sage

Yes this will only work for reply emails, If you want to make it work with new inbound, you will have to manage that in the Inbound Email action by replacing the description using below:

current.description=email.body_text.replace(/<your text>+.*/, '');

 

This does seem to work, however as it states it only ignores anything below this lines: So I had an email content as below:

 find_real_file.png

 

Email received as below, you won't see it truncated it in email logs.

find_real_file.png

And finally the email property:

find_real_file.png

So I think you just need to arrange the newlines characters.

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.

That did the trick, thank you very much.

There was a typo with your quotes, so in case someone else finds this question with a similar problem, the actual argument is as follows:

... email.body_text.replace(/DISCLAIMER: This email, together with any attachments+.*/,"")

diNesh_M
Tera Contributor

Hi mjl,

The below script only helps me to remove only the first line of the Disclaimer message but i want to remove all the line in the Disclaimer message ,how can i achieve it?

 

email.body_text.replace(/DISCLAIMER: This email, together with any attachments+.*/,"")

 

Thanks