
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2019 10:41 AM
Hey SN Comm!
I am looking for some help with an inbound email action.
Aside from utilizing the Predictive AI Auto-assign feature in SN (I have a Case open with HI as there is an issue with ours), I want to build out an inbound action to start testing, in order to use those as an option for auto-assigning cases via emails.
My first try, I created an inbound action, using the HR Payroll table as the target. I took the same script from OOTB 'Create HR Case' Inbound Action. Only here, I changed the When to Run options. For the When to Run section, I stated for the condition: Subject contains paycheck/pay/paycheck issue.
At first, I had this Inbound Action NOT checked to Stop Processing. When I sent an email into the system, having my subject line read 'paycheck issue', the case was still created under General HR Service.
Then, I made it so the Stop Process box was checked. Sent email in. The Case was created under the right COE, assigned to the right assignment group, however still used the General HR Service.
Also, from the email logs, the Target field was empty, but I could see from the email logs related list area, that a Payroll case was created.
Is anyone able to assist me with created the proper inbound action, and how it should be created?
Here is what I have for reference:
//Set all basic HR fields
if (email.importance !== undefined) {
if (email.importance.toLowerCase() == "high")
current.priority = 1;
} else
current.priority = 3;
var bodyText = email.body_text;
if (!bodyText)
bodyText = email.body_html;
current.work_notes = "HR Case created by email:\n\nReceived from: " + email.origemail + "\n\n" + email.subject + "\n\n" + bodyText;
current.description = bodyText;
// Core email rules assign "Guest" if the from email does not match a user.
// In this case, check the HR profile personal email, and reassing the case to that user.
var profile;
if (gs.getUserID() == '5136503cc611227c0183e96598c4f706') { //GUEST SYS_ID
profile = new GlideRecord('sn_hr_core_profile');
profile.addQuery('personal_email', email.origemail);
profile.query();
if (profile.next()) {
current.hr_profile = profile.sys_id;
current.opened_for = '';
current.opened_by = gs.getUserID();
if (profile.user) {
current.opened_for = profile.user;
current.opened_by = profile.user;
}
} else {
current.opened_by = gs.getUserID();
current.opened_for = gs.getUserID();
}
} else {
// Find and attach profile if it exists
current.opened_by = gs.getUserID();
current.opened_for = gs.getUserID();
profile = new GlideRecord('sn_hr_core_profile');
profile.addQuery('user', gs.getUserID());
profile.query();
if (profile.next())
current.hr_profile = profile.sys_id;
}
current.subject_person = current.opened_for;
var newId = current.sys_id;
gs.eventQueue('sn_hr_core_case.email.creation', current, newId, email.from);
Here is what I got after case was created (somewhat correctly)(with Stop Processing checked)
Had to go to list view of ALL cases (I think due to the wrong service still being used)
Any help would be great!
Cheers!
-Rob
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 12:01 PM
ServiceNow has found the error as to why our Predictive AI Auto-assign feature was not working.
We are moving forward with that, rather than deal with more Inbound Actions.
Thank you all!
-Rob

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2019 10:59 AM
Do you have the payroll inbound action running before he general inquiry inbound action? The "Order" number would dictate this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2019 11:04 AM
Hi Kirstin,
Yes, this new payroll inbound action is running before the hr general inbound action.
The OOTB 'Create HR Case' order is 80, the Payroll one I am trying to create/work with is order 20.
Thanks,
-Rob

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2019 11:28 AM
Couple of things I'd like to try before taking further troubleshooting to figure this out.
1 - The incoming email itself. Who is sending this email and is this person allowed to create a case on that particular CoE? Any ACLs or BRs blocking the case from being created?
2. Are there are any mismatching Topic Categories / Topic Details / HR Services that might be causing this?
Once the above 2 are confirmed, as a step to figure this out, remove the HR Service assignment on the Field Options and do this on the script. On the script, do current.hr_service = <sys_id of the specific HR Service>.
See if this helps. I have created specific HR Service based on inbound and for various reasons, used the assigning HR Service on the script instead of on the Field Options and it has worked well.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2019 07:51 AM
Hello Ashok,
1 - I am sending the email into a test instance for this. We have nothing wrapped around emails to send to a special COE. Anyone that sends an email to our system, a Case is created (within reason).
2 - There are no mismatching that I have noticed
I took out the Field Option for the HR Service and hard coded the sys_id for the hr service.
I noticed something odd... I sent a new email into the system and had paycheck issue in the subject line. The Case was created, twice... Once using the correct COE Prefix number, however the HR Service was still made as General Inquiry. And then of course the HRC case created, is also using General Inquiry.
I am slightly baffled right now 😞
How would an email creation do that? lol
Thanks,
-Rob