Inbound email to get values from the users email body
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2020 08:07 AM
Hello Developer,
This would be the email body from client,
* Yellow marked 6 lines should be the updated in the worknotes/comment when incident is created via inbound email.
* Red Arrowed " Blue selected " : User ID should be selected as caller field & Opened by field in the incident created via inbound email.
Can someone please help on this, How to achive this task ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2020 08:18 AM
Hi,
Try below in your inbound mail action
var bodyis=email.body_text; //This gives you complete body of email
var getrequiredtextstart=bodyis.split('worked on immediately,')[1]; //This gives you text after worked on immediately text
var getrequiredtextend=getrequiredtextstart.split('Issue:')[0];//This gives you text before Issue: keyword
current.work_notes=getrequiredtextend; //This is final yellow text
var useris=email.body.UserId;//will give you James1234
var setuser=new GlideRecord('sys_user');
setuser.addQuery('user_name',useris);
setuser.query();
if(setuser.next())
{
current.caller_id=setuser.sys_id;
current.opened_by=setuser.sys_id;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2020 08:20 AM
thank yu, Sure i'll try this once quickly and update you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2020 08:18 AM
You can access the values in an inbound action like so:
email.body.description
email.body.dns_name
email.body.ip_address
email.body.plant
email.body.location
email.body.userId
So to set worknotes:
var worknotesStr = "The test information as follows:\n";
worknotesStr+= "Description:" + email.body.description + " \n";
worknotesStr+= "DNS Name:" + email.body.dns_name+ " \n";
//etc
current.work_notes = worknotesStr;
Also refer to:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2020 08:20 AM
thank you, Sure i'll try this once quickly and i'll update you