Recognizing the Original Sender of a Forwarded email

Joe75
Tera Contributor

So i'm using my free dev instance and working on starting 'tickets' (cases) from an email.  I've got the inbound email action working for one sent from an email, so there's no issue there.  The issue i'm having is dealing with the forwarded email.  I've created the inbound email action (forwarded email) and got it to populate a my Submitted By field from the forwarded email.  One I can't get to work is when the email has been forwarded more than once to get the user information from the original email.

This line works for the email only being forwarded once:

current.submitted_by = email.body.from.split("<")[0];

I would greatly appreciate any help with configuring it to pull the user from the original email for situations (though highly unlikely) where the email has been forwarded an additional x number of times before getting to the servicenow instance.

-

Joe

8 REPLIES 8

Mark Stanger
Giga Sage

I've never seen this issue in the incident app and I think they just use 'email.origemail' there to identify the original sender regardless.  Have you tried that?

Mark,

I was trying to use that by placing the orgemail:

current.submitted_by = email.orgemail.body.from.split("<")[0];

and

current.submitted_by = email.body.orgemail.from.split("<")[0];

Neither worked; it sent the emails to the general Incident module within ServiceNow and still didn't populate the field correctly, in fact it left the field blank.

Note:  Just to clarify the last part of the line (split.("<")[0]; it is there to so it doesn't pull the email in the signature block that is hyperlinked.

Can you try logging email.origemail with nothing else to see what that gives you? Note that it is 'orig' not 'org'.

So...

using 

current.submitted_by = email.origemail.from;

sends to the correct location but does not populate the submitted by field

using

current.submitted_by = email.origemail;

sends it to the generic incidents section and doesn't populate the correct field

using

current.submitted_by = email.origemail.from.split("<")[0];

sends to the generic incidents section and doesn't populate the correct field