Forward inbound action script to search previous sender

KB15
Giga Guru

I'm looking to see if anyone has already created an inbound action (forward) script that will search for the previous sender and not the sender found in the header. I know it can be done, I just don't have the scripting to make it work. A company I used to work for had this in their instance.

The reason for this is that support staff have a tenancy to forward emails to ServiceNow to create incidents. But instead of the caller being the one selected, it's the tech that becomes the caller. The original caller never gets the incident notification when it's created. I've looked around and I haven't come across anyone who's implemented this on the community.

5 REPLIES 5

heathers_
Kilo Sage

This is what worked for me.

 

var str = email.body.from;
var mySubString = str.substring(
    str.lastIndexOf("<") + 1,
    str.lastIndexOf(">")
);
current.opened_for = mySubString;
current.opened_by = mySubString;