- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 02:34 AM
Hi,
Just wondering if anyone can advise me on the script i would require to have new emails update a current incident if they have the INC reference in the subject line? We have various customers who communicate with us using their own ticketing systems so Service Now classifies their emails as new. We can get them to add the INC reference to the subject line but SN will only use that to update a current incident if the email is classified as a reply.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2017 09:34 PM
David,
Can you share the subject line you used?
Ideally if it contains INCxxxxxxx it should process the script since the condition meets.
Also change the script to following, this should update your short description to the email body text and ends processing of inbound mail against other email actions.
gs.include('validators');
if (current.getTableName() == "incident")
{
var index = email.subject.indexOf("INC");
var incNumber = email.subject.substring(index,index+10);
gs.log(incNumber,'test');
var gr = new GlideRecord('incident');
gr.addQuery('number',incNumber);
gr.query();
while(gr.next())
{
gr.short_description = email.body_text;
gr.update();
event.state="stop_processing";
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 05:44 AM
Hi David,
I tried your scenario and this is working for me. I guess there might be little changes that might you need to make according to your cases but this script works perfectly.
Create a new inbound action on the incident table as below :
In the script use the following :
gs.include('validators');
if (current.getTableName() == "incident")
{
var index = email.subject.indexOf("INC");
var incNumber = email.subject.substring(index,index+10);
gs.log(incNumber,'test');
var gr = new GlideRecord('incident');
gr.addQuery('number',incNumber);
gr.query();
while(gr.next())
{
gr.u_description = email.body_text;
gr.update();
}
}
Please let me know if you need any further help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 05:57 AM
Hi David,
Maybe you could ask your customers to use a specific unique prefix in the subject of their emails. In the email properties you could add those prefixes to the
"Identify email as reply by these subject prefixes" property (glide.email.reply_subject_prefix).
Kind regards,
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 08:00 AM
Interesting idea Paul, the only trouble is getting customers to do the things i need them to, they're notoriously unreliable. I need Service Now to parse the whole subject line as customers are wont to add references anywhere and everywhere!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 07:59 AM
Thanks Harneet, that doesn't seem to be working in my case, perhaps it needs some tweaking somewhere. Thanks for the response though.