Using an inbound email action script, how can I map values from the email to a field in servicenow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2016 02:38 PM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2018 06:14 AM
Hi, I used this thread to successfully achieve what you're after: https://community.servicenow.com/community?id=community_question&sys_id=78370b29db1cdbc01dcaf3231f9619e3
I.e. use script as below for e.g. setting the caller value from the email body text as the caller_id in the incident:
if (email.body.caller != undefined) {
var c = new GlideRecord('sys_user');
if (c.get('user_name', email.body.caller))
current.caller_id = c.getValue('sys_id');
}
Then ensure somewhere in email you have the caller defined e.g. 'Caller: JBloggs123'
Cheers.