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-12-2019 12:52 AM
It's 90% there.
Using the script I posted earlier, I am able to get "Help Creating ticket - Ticket#11678150/premerabluecross"
I would just need everything after the first slash to be removed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2019 12:53 AM
Could you test with:
var strLeft = str.substr(0,str.indexOf('/')).trim();
var strRight = str.substr(str.indexOf('/') + 1).trim();
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 01:06 AM
This is the result:
"premerabluecross/Premera - Change CHG0015407 has been created -- has been updated --- Ticket#11678150"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2019 01:10 AM
Oke this looks like the ticket part is now at the end and the rest is still there. That was the goal right? Or did we still mis something?
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-15-2019 08:51 AM
Hi there,
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