Exclude email address from inbound action and other question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2018 02:46 AM
Hello,
I have 2 questions/queries:
1. We have 2 inbound actions that create incident when email comes to servicenow thanks to 2 inbound actions. I want to exclude certain email address from one of them. Can someone help with javascript for this?
2. We have a scenario: User X sends email to mailbox Z. Mailbox Z forwards email to ServiceNow which then creates ticket. Is there any possibility to set caller of ticket to user X even if the email was forwarded by mailbox Z?\
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2018 03:05 AM
Hi Dawid,
1. If they're in your user table you can set the trigger condition to be 'if user is not this user' otherwise you can use indexOf to identify the address and exclude it:
var emails = email.from.toLowerCase();
if(emails.indexOf('enteryouremailaddress@here.com') > -1){
return;
}
2. It depends on how you have set up the forward. It should still recognise the original sender and set them as the caller if you've just set up an automated forward on the mailbox.
Regards
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2018 06:10 AM
Hi David, thanks for reply.
For #1, where exactly should this piece of code go? Here's the actual script of the inbound action I want this email address to be excluded:
(function() {
try {
//logIt('\n\nStarting DEV Create Request....', 'debug.u_request');
gs.include('createInboundRequest');
createInboundRequest();
logIt('Req test ' + email.body.foo_bar, 'debug.u_request');
} catch (err) {
var strErr = 'Error in Inbound Action : DEV Create Request'
+ '\n\nError Type: ' + err.name
+ '\nError message: ' + err.message;
logIt(strErr, 'error');
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2018 09:15 AM
Hi,
for 2nd case Use below code in condition field
email.origemail.toLowerCase()!='youremailaddress'
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2018 09:27 AM
for 1st case:
if you have to exclude multiple emails:
1. Create a table that will contains all the email addresses (added to columns Email and Active).
2. Create a script include to validate email.
3. Call this script in to validate in inbound action condition field.
function ValidateEmail(email){
var gr=new GlideRecord('yourtablename');
gr.addEncodedQuery('u_email='+email+'^u_active=true');
gr.query();
if(gr.next())
return false;
else
return true;
}
Call above script in condition filed
Thanks