- 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
‎09-16-2022 05:00 AM
Thanks,
Harneet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2023 07:53 AM
@Harneet Sital I have used your script above and it does update the incident but It also creates a new incident at the same time. Any idea why an incident is being created? I verified the Tigger order, and logs show the same action is creating a new incident and also updating the older record.
We have the inbound Action Type set to NONE as the vendor emails have many different types of subject lines.
Thanks in advance.
G