- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2020 01:12 AM
Hi Team,
I have created a inbound email action that will log a new ticket. I have a requirement that if user replies from same original mail thread, email body text should update in additional comments of the already logged ticket.
Please help me to achieve this.
Thanks in advance.
Anand.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2020 01:24 AM
Hi Anand,
System will automatically take care of that if you have
1. Inbound of type : Reply
2. Watermark is present on the mail received (MSG....) is the message number at the bottom of the mail that ServiceNow recognizes to categorize it as reply or new or forward mail
3. If above are configured can you share the inbound action script once.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2020 01:24 AM
Hi Anand,
System will automatically take care of that if you have
1. Inbound of type : Reply
2. Watermark is present on the mail received (MSG....) is the message number at the bottom of the mail that ServiceNow recognizes to categorize it as reply or new or forward mail
3. If above are configured can you share the inbound action script once.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2020 06:26 AM
Hi Jaspal,
Thanks for your response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2020 02:24 AM
hi,
I am assuming you're sending an Incident number somewhere in the email body or in the subject of the email.
so once that user reply back to that email you can create an inbound action as shown below
as you can see I have added a condition as subject contains incident you can add more condition to specifically trigger this inbound action and not any other inbound action.
lets suppose the subject is something like..
Re: New incident created INC0010017
now in your action script do something like this to extract the incident number from subject to update comments with email body on that specific incident.
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
//lets suppose the subject is Re: New incident created INC0010017
var string =email.subject;
var number = string.match(/(\binc\S+\b)/ig);
//above statement will give us array of words starting with inc we will get two words (incident,INC0010017)
//incident word is on idex 0 and INC0010017 is on index 1 so we will use index one to get incident number
var incident=new GlideRecord('incident');
incident.addQuery('number','=','number[1]');
incident.query();
if(incident.next())
{
incident.comments=email.body;
incident.update();
}
// Implement email action here
})(current, event, email, logger, classifier);
give a try and mark my answer correct if this sovles your issue or if that helps you please mark my answer as helpful.
thanks
hammad ul aziz