Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Inbound email action, capture only latest reply

Anurag Tripathi
Mega Patron
Mega Patron

Hi Members,

I have an inbound email action that simply captures the response (replies only) and whatever comes in the email copy it to the ticket's comments. But if that email becomes a chain, multiple replies, the whole chain gets updated each time. That can be avoided if there is a way to capture the latest response in the incoming email.

Has anyone done this?? or any ideas??

-Anurag
1 ACCEPTED SOLUTION

sach1
Tera Guru

Never tried this but i think the approach for this would be to take only the content from the email where "From" starts with senders name. Found similar query on stack overflow.Below is the link:



javamail - Reading only the latest replied content using java mail multipart MIME - Stack Overflow




http://stackoverflow.com/questions/16984235/parsing-reply-email-to-take-only-the-latest-part


View solution in original post

8 REPLIES 8

sach1
Tera Guru

Never tried this but i think the approach for this would be to take only the content from the email where "From" starts with senders name. Found similar query on stack overflow.Below is the link:



javamail - Reading only the latest replied content using java mail multipart MIME - Stack Overflow




http://stackoverflow.com/questions/16984235/parsing-reply-email-to-take-only-the-latest-part


Thanks Sachin



Here is the final solution




var messageContent = email.body_text;


if (messageContent.indexOf("From")!=-1)
   
{
  messageContent
= messageContent.substring(0, messageContent.indexOf("From")).trim();
   
}
   
else
   
{
  messageContent
= messageContent.trim();
   
}




// now messageContent   contains the latest reply only....




I have tested incoming mails from Microsoft Ourlook....ill will check from some other sources also and will post in case of any issues....


-Anurag

Welcome. Lotus notes also have the similar mail format as that of Outlook so it will for lotus notes as well.


That was my only worry as i don't have lotus notes....web mails and all i will check but i am positive that it will work


-Anurag