- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2016 11:49 AM
Hi,
I am using the inbound email notification Update Case via AcceptReject, Where I need to modify the condition on this. Given the requirement below.
Current Logic: ((new CSEMailUtil).isUserExist(email.from)) && (current.contact.email == email.from)
New Logic: ((new CSEMailUtil).isUserExist(email.from)) && ((current.contact.email == email.from) OR (user is on the customer update list))
It has to accept the email from who are there in watch list. So please assist me.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 10:06 AM
Blow code works for me.
Script Include:-
==================
var isEmailInList = Class.create();
isEmailInList.prototype = {
initialize: function() {
},
isEmailInWL : function(list, email) {
var u = new GlideRecord('sys_user');
u.addQuery('email', email);
u.query();
if(u.next())
{
var id = u.getValue('sys_id');
var lst = list.toString();
var array = lst.split(",");
for(var i = 0; i < array.length; i++)
if(array[i] == id)
{
return true;
}
else{
return false;
}
}
},
type: 'isEmailInList'
};
Condition:-
(((new CSEMailUtil).isUserExist(email.from)) && (current.contact.email == email.from)) || ((new isEmailInList).isEmailInWL(current.watch_list, email.from))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2016 07:08 AM
Hello All,
I have used below code but its not working for me so could you please help me on this.
function isEmailInList(list, email) {
var gr = new GlideRecord('sys_user');
gr.addQuery('email', email);
gr.query();
while(gr.next());
{
if (list.indexOf(gr.getValue('sys_id')) > 0)
{
return true;
}
return false;
}
}
And my condition is ((new CSEMailUtil).isUserExist(email.from)) && (current.contact.email == email.from) || isEmailInList(current.watch_list, email.from)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2016 12:06 PM
Hi Narender,
Please refer below blog for more info. Adjust your script accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2016 07:07 AM
Hello All,
I have used below code but its not working for me so could you please help me on this.
function isEmailInList(list, email) {
var gr = new GlideRecord('sys_user');
gr.addQuery('email', email);
gr.query();
while(gr.next());
{
if (list.indexOf(gr.getValue('sys_id')) > 0)
{
return true;
}
return false;
}
}
And my condition is ((new CSEMailUtil).isUserExist(email.from)) && (current.contact.email == email.from) || isEmailInList(current.watch_list, email.from)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2016 07:14 AM
You have a syntax error in your code, remove the semicolon after while. Instead you could make your script short by using chuck's code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2016 10:06 AM
Blow code works for me.
Script Include:-
==================
var isEmailInList = Class.create();
isEmailInList.prototype = {
initialize: function() {
},
isEmailInWL : function(list, email) {
var u = new GlideRecord('sys_user');
u.addQuery('email', email);
u.query();
if(u.next())
{
var id = u.getValue('sys_id');
var lst = list.toString();
var array = lst.split(",");
for(var i = 0; i < array.length; i++)
if(array[i] == id)
{
return true;
}
else{
return false;
}
}
},
type: 'isEmailInList'
};
Condition:-
(((new CSEMailUtil).isUserExist(email.from)) && (current.contact.email == email.from)) || ((new isEmailInList).isEmailInWL(current.watch_list, email.from))