inbound action - email.origemail

sarahkapasi
Giga Expert

So we have a requirement as to whenever a user emails to email XYZ@gmail.com the email will be auto forwarded to ServiceNow, and we have an inbound action to create an incident for that email.   The caller_id should be the original original sender.   We have the following inbound action,   But it keeps putting XYZ's name instead of the original senders name.

Please let me know what I am missing?

current.comments = 'received from: '+ email.origemail + '\n\n' + email.body_text;

current.short_description = email.subject;

current.caller_id = email.origemail;

current.opened_by = 'system';

current.u_current_location = 'N/A';

current.u_alternate_phone = 'N/A';

current.contact_type = 'email';

current.impact = 4;

current.urgency = 4;

current.category = 'hardware';

current.u_last_updated_by = 'system';

current.cmdb_ci = 'b12861c50f8331003b0846ace1050e0e';

current.assignment_group = '3257926a0f423e40d0535d78a1050e47';

current.insert();

5 REPLIES 5

BALAJI40
Mega Sage

Hi Sarah,


Use this line,   current.caller_id = email.from_sys_id;



current.comments = 'received from: '+ email.origemail + '\n\n' + email.body_text;


current.short_description = email.subject;


current.caller_id = email.from_sys_id;//Contains the Sys ID of the user who sent the email to the instance.


current.opened_by = 'system';


current.u_current_location = 'N/A';


current.u_alternate_phone = 'N/A';


current.contact_type = 'email';


current.impact = 4;


current.urgency = 4;


current.category = 'hardware';


current.u_last_updated_by = 'system';


current.cmdb_ci = 'b12861c50f8331003b0846ace1050e0e';


current.assignment_group = '3257926a0f423e40d0535d78a1050e47';


current.insert();


Thank you Balaji.



I changed it to the following, but it still doesn't put the original senders name.



find_real_file.png


amitra2
Kilo Contributor

Hi Sarah,


As the email is auto-forwarded from the email address XYZ@gmail.com to servicenow, servicenow recieve the mail from XYZ@gmail.com instead of the original sender. email.origemail Contains the email sender's address as listed in the email Headers.As thee mail is coming from XYZ@gmail.com, I think the sender's address in the header field is XYZ@gmail.com. That is why the caller is populated as XYZ@gmail.com.


As the forwarding process is automated, try to insert the real sender's email information in the email body so that you can retrieve the information after receiving the forwarded email and use in the field of caller id.You should keep in mind that the user must have an user account in Servicenow.



Regards,


Amitra


DirkRedeker
Mega Sage

Hi

"current.caller_id" is a sys_id and "email.origemail" is a String (of th sender).

Try to GlideRecord to the "sys_user", with the given EMail Address in "email.origemail", and place the Sys_ID of the user found in the "current.caller_id" field. I guess this will work.

Let me know if that solved your question and mark my answer as correct and helpful.

BR

Dirk