Extract text from inbound email and post to description field on target record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2019 11:19 AM
Hi All,
I have a requirement to extract data from an inbound email and post to the short description field on the target record.
We have an integration setup using notifications and when the record is initiated on the other system, it will respond in email with that ticket number.
I have attached a sample of the inbound email. I am looking to extract the line: Ticket #xxxxxxxx.
Thanks in advance!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2019 08:14 AM
Hi John,
Did this solve your question? Or do we need to follow up on this?
Please mark this answer as correct if it solves your problem. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2019 03:04 AM
Hi John,
Did this solve your question? Or do we need to follow up on this?
Please mark this answer as correct if it solves your problem. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2019 12:54 AM
Try like this
Hi, Try this code and it shoudl work.
var ticket = email.subject;
ticket = subject.split("/");
gs.log(ticket[0]);
var sub = current.short_description;
current.short_description = sub + " - " + ticket;
current.update();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2019 12:58 AM
This is not going to work if there are multiple slashes as mentioned in one of the earlier posts.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2019 01:03 AM
I thought what is needed is the string before the 1st slash and ignore all others.
So
ticket = subject.split("/");
ticket[0] returns the string before the first slash.