Incidents created from forwarded emails not setting original sender as Caller

scottbaker
Kilo Contributor

We're having an issue with inbound emails, specifically forwarded emails, not creating incidents with the original sender as the Caller.  Here's an example from our Dev instance:

I received an email from Jason Sears, who is a registered and active user in ServiceNow.  I forwarded this email to our Dev instance's default mailbox.  Here's what the incident record looks like:

 

find_real_file.png

As you can see, it created with me as the Caller.  Looking at the email logs, I see this:

find_real_file.png

It's clearly identifying the email as a forward and getting processed by the correct Inbound Action, but I'm wondering if my issue doesn't have something to do with the first highlighted box where it mentions not searching for a From:.  The Inbound Action for 'Create Incident (Forwarded)' is the default action, but I can post the script if necessary.  Can anyone shed some light on why it's not correctly matching the original sender to a user?  Thanks!

14 REPLIES 14

Can you also try:

current.caller_id = email.body.from;

if that doesn't work (sorry for all the testing), let's do this:

-Comment out any caller_id assignment you have

-use 

current.email = email.origemail;

So the theory is that the caller field is a reference to the sys_user table and since the email will now be populated in the email field, perhaps the Caller ID will self-populate based off the dot-walk from the email.

 

Worth a shot?


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

I'm giving these a shot now, thanks for your help!  I'll let you know how it looks with those changes.

Allen,

 

I made the first change you suggested and the Caller is now blank.  I got the same result with the second change as well.  Here's my current script, just in case I didn't apply either suggestion correctly:

 

//	Note: current.opened_by is already set to the first UserID that matches the From: email address

//current.caller_id = gs.getUserID();
//current.caller_id = email.origemail;
//current.caller_id = email.body.from;
current.email = email.origemail;
current.comments = "forwarded by: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;

current.category = "request";
current.incident_state = IncidentState.NEW;
current.notify = 2;
current.contact_type = "email";

if (email.body.assign != undefined)
   current.assigned_to = email.body.assign;

if (email.body.priority != undefined)
   current.priority = email.body.priority;

current.insert();

Yea, see my post below about ensuring that the inbound action type is actually set to Forward. It sounds like that may be the issue here.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

scottbaker
Kilo Contributor

Allen's comment got me thinking:

Here's the first section of the inbound rule with Allen's suggestion:

//current.caller_id = gs.getUserID();
current.caller_id = email.origemail;
current.comments = "forwarded by: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;

Looking at the incident records that are being created, they show this:

find_real_file.png

This leads me to think that there's some reason that the email.origemail function isn't grabbing the correct email for some reason.  This particular email was sent to me from jsears and forwarded into ServiceNow, however it's showing me as the original sender.