Recognizing the original recipient list from a forwarded email using Inbound Action

heathers_
Kilo Sage

What's the best method for retrieving the original recipient list from a forwarded email.

 

Scenario:

1. Original email with multiple recipients in "To" and "Cc" is forwarded to SN. The result, only the SN email address is stored in email.to

 

2. The original sender of the forwarded email is captured in email.body.from

 

3. Requirement is to capture the original recipient list before the email was forwarded and store email values to be used later.

 

Example: Email was sent by Jessica with Heather, Adele in "To" and Wendy, Rebecca in "Cc."  Next, the email was forwarded to SN. Using an Inbound Action, the forwarded email creates a record. 

 

heathers__0-1719335765623.png

 

 

1 ACCEPTED SOLUTION

heathers_
Kilo Sage
I was able to capture the original recipient list using email.body.to AND email.body.cc.

View solution in original post

5 REPLIES 5

 

var opened_for = '';

var str = email.body.from;
var mySubString = str.substring(  //mySubString equals the email address
    str.lastIndexOf("<") + 1,
    str.lastIndexOf(">")
);

var user = new GlideRecord('sys_user');
user.addQuery('email', mySubString);
user.query();
if (user.next()) {
    opened_for = mySubString;
} else { //Can't match on email address
    opened_for = sys_id of your choice
    current.field_name = mySubString; //This line is necessary if you are tracking the email address on the form
}

current.opened_for = opened_for;

 

@SatiirS