Extract text from inbound email and post to description field on target record

John Prahn
Kilo Contributor

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!

30 REPLIES 30

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. 

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

LinkedIn

This is the result:

"premerabluecross/Premera - Change CHG0015407 has been created -- has been updated --- Ticket#11678150"

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

LinkedIn

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

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn