Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Inbound Email Action for Specific domains

monkalope
Tera Expert

I hope I am not missing another topic that has already touched base on this but if I did I apologize. We are getting ready to start working on some inbound actions and here are some scenarios:

Email will be sent to a specific address > hits exchange and we will redirected to SNC Instance.
We want the inbound action to look for 1 or 2 specific domains as they would have some specific assignment rules (groups, priority, etc.).

Any assistance would be appreciated.

2 REPLIES 2

Joe_Employee
Tera Contributor

Have you looked at:

http://wiki.service-now.com/index.php?title=Inbound_Email_Actions#Creating_a_User_from_Incoming_Email


dave_m13
Kilo Contributor

Hi

The last time I did this with an inbound action trying to populate the domain it did not work.
So something like below would never pass the display value, I tried using the exact sys id that did not work either.

if (emailTo.indexOf("snctest@domain.com") >= 0) {
current.domain.setDisplayValue("UK");

What I did was amend the Create Inbound Action to include the following so the assignment field will populate based on where the e-mail has come from.

var emailTo=email.to;
emailTo=emailTo.toLowerCase();

current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;

var sid = gs.createUser(email.from);

if (emailTo.indexOf("snctest@domain.com") >= 0) {
current.assignment_group.setDisplayValue("Service Desk UK");
}
if (emailTo.indexOf("snctest1@domain.com") >= 0) {
current.assignment_group.setDisplayValue("Service Desk US");

etc etc.

To get the domain field to be populated with the correct domain I changed the OOTB BR - Domain - Set Domain - Incident to something similar to below. Though I actually think I used company.sys_domain rather than caller_id.sys_domain in the end.

if (current.caller_id.sys_domain == '' || current.caller_id.sys_domain == 'global') {
current.sys_domain = current.u_task_for.sys_domain;
}
else {
if (current.caller_id != '') {
current.sys_domain = current.caller_id.sys_domain;
}
}

I believe this is fine for users that are already in Service Now, however for users that are not i.e. new Incident to be raised as guest, this makes things a little more difficult as guest is a global user.

Hope this helps.

Cheers
Dave