Using an inbound email action script, how can I map values from the email to a field in servicenow?

Tyler Michals
Kilo Guru

A user fills out a form and clicks submit via webpage.

An email is sent to our instance and creates an incident.

This is what a portion of that inbound email looks like:

First Name: John

Last Name: Smith

Employee Contractor Id: 8675309123

Email Address: john_smith@yahoo.com

I would like to take the email address provided in the body of the email and map it to the "caller_id" field in service now.

Currently I am using this script and it is not working:

if (email.body.Email_Address != undefined)

    current.caller_id = email.body.Email_Address;

Please Help!

10 REPLIES 10

reedwowens
Giga Expert

I would remove the spaces in the name of the fields.   Try FirstName or First_Name for example in your email body.   Also the action is always lowercase.   For instance these examples I gave you would be email.body.firstname or email.body.first_name.



Check Field values from the email body


In the body of the email, I changed "Email Address" to just "email".



The email was being sent from an email address that was not a user in servicenow. I had to create a user, and give it roles in order for the value to be mapped to a field on the incident form. The inbound action now works. Thanks for your help.


You can send an email to someone that is not a user in ServiceNow.   You need a string field with the email address you want to send to and specify it in the notification.


I dont think you understand what I was saying...



An email was being sent to our servicenow instance from a random email address; lets say smith@aol.com. I had to create a user for smith@aol.com so smith@aol.com could write to the incident form automatically from the script