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

asifnoor
Kilo Patron

Hi John,

In your email body, if you want to access any specific text, then format your mail like this

Var1: text

var2: text

then you can read them like below

email.body.Var1 and it will give the value.

So in your example, you can read the ticket like this

var ticket=email.body.ticket;

var gr = new GlideRecord("incident");

gr.initialize();

gr.short_description=ticket;

gr.insert();

Mark the comment as a correct answer and also helpful once worked.