- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2016 09:40 AM
Hi,
We have set up email filters and ignore emails if it comes from certain users which we consider as spam and put them in the junk folder. For this purpose we have setup the conditions using the condition builder. As per the wikis Email Filters - ServiceNow Wiki the value entered in conditions is case-sensitive.
We've started getting many spams where, for example, the domain ends with 'ASIA' and several variations of it with a mix of upper/lower case letters. So, we get 'ASIa', 'asIA', 'asiA' etc. How can I ignore the case in the conditions.
Thanks,
Shalini
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2016 12:54 PM
It should, though I am not positive about the field name of the Sender email address (I guessed origemail because that is what it is in other Email Scripts) but also, in these condition scripts, you don't return the answer but set the magic variable "answer" to whether or not you want to allow the email past your filter.
Additionally, you'll probably want to add to this list in the future, so you should write for that eventuality now, as opposed to later.
Try this:
// add to this list as necessary
var filters = [
/asia$/i
];
var answer = true; // allow email
// this field could be different
var field_to_check = email.origemail;
for (var i = 0; i < filters.length; i++) {
if (filters[i].match(field_to_check)) {
// we hit a filter, mark the answer as FALSE
// to disallow this email from going past
answer = false;
}
}
Best of luck,
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2016 07:47 AM
Thanks Andrew! I do not see the option to mark it as the 'Correct Answer'. It helped me block this domain.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2016 11:39 AM
Hi Andrew,
Even though I had the script for the filters, a incoming email from a domain name "@eePeTraDAaL.h1.AtR.ASia' created a ticket in our system.
I used the following code. I added few more filters to the list. What could have happened?
var filters = [/asia$/i, /top$/i, /xyz$/i, /cricket$/i, /loan$/i, /review$/i];
var answer = true;
var field_to_check = email.origemail;
for (var i = 0; i < filters.length; i++) {
if (filters[i].match(field_to_check))
{
answer = false;
}
}
Thanks!
Shalini
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2016 10:08 AM
Hi,
Can you check the below link. I hope this will help you.
http://wiki.servicenow.com/index.php?title=Operators_Available_for_Filters_and_Queries#gsc.tab=0