Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2019 02:47 AM
Create an inbound action for the type 'New', set the order to less than your create incident inbound action and set it to trigger when the subject contains 'INC', the following code should go ahead and find the incident it is related to and update the relevant section:
gs.include('validators');
var index = email.subject.indexOf("INC");
var incNumber = email.subject.substring(index,index+10); //change this depending on how long your incident references are
var gr = new GlideRecord('incident');
gr.addQuery('number', incNumber);
gr.query();
if(gr.next()) {
if(email.subject.toLowerCase().indexOf("worknotes") >= 0){
gr.work_notes = "reply from: " + email.origemail + "\n\n" + email.body_text;
gr.update();
event.state="stop_processing";
}
else{
gr.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
gr.update();
event.state="stop_processing";
}
}