- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2017 09:02 AM
Can anyone help me retrieve the original email address from a forwarded email into our instance. I have tried various methods posted to the community however nothing seems to pull the correct account. This is the part of code im having trouble with from my inbound email action (forwarded)
sidenote: Im a super novice when it comes to javascript. just looking how to set current.caller_id as the original sender, everything else in the IEA works as it should.
var orig = new GlideRecord('sys_user'); if (orig.get('email', email.origemail)) {//if you find a user with that email, get that user's sys_id current.caller_id = orig.sys_id; } current.comments = "forwarded by: " + email.origemail + "\n\n" + email.body_text;
Shows it was forwarded by me, rather than the original sender. I have also tried the below codes and still does not work.
current.caller_id = email.origemail;
current.caller_id = email.from_sys_id;
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2019 08:01 AM
I had reached out to HI support after entering this in the community.
The script they provided to help was below, i had modified it to match our requirements, but this is the base i went from.
if(email.body.from != undefined) {
var user = email.body.from;
var array = user.split(/\s*,\s*/);
var ln = array[0];
var fn = array[1];
var gr = new GlideRecord("sys_user");
gr.addQuery('first_name',fn);
gr.addQuery('last_name',ln);
gr.query();
while(gr.next()) {
current.caller_id = gr.sys_id;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2017 09:41 AM
Development update.
I was able to populate the contact field with the below part, however it didnt match the user to an actual email address and created the user account from the email.
(we have the property set to create user account from approved email domains)
current.caller_id = gs.createUser(email.body.from); (i know gs.createUser is not supported, was the only thing that has worked thus far. Im still testing various methods)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2019 05:23 PM
Hi - how did you get on with your investigations? I have a similar issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2019 08:01 AM
I had reached out to HI support after entering this in the community.
The script they provided to help was below, i had modified it to match our requirements, but this is the base i went from.
if(email.body.from != undefined) {
var user = email.body.from;
var array = user.split(/\s*,\s*/);
var ln = array[0];
var fn = array[1];
var gr = new GlideRecord("sys_user");
gr.addQuery('first_name',fn);
gr.addQuery('last_name',ln);
gr.query();
while(gr.next()) {
current.caller_id = gr.sys_id;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 08:52 PM
Hi - how did you get on with your investigations? I have a similar issue.