"Out of office" emails are being getting added on the incident comments. But need to stop out of office emails

sinu2
Tera Expert

Hi all, 

I am struck with one issue, client has raise one priority issue that, 

@scenario:: when ever an email notification gets triggered to any group. If any one of the groups is in "out of office" mean if any one of the user in that group puts auto reply email about "out of office" that time auto reply emails is being gets attached in the incident comment. NOW I NEED TO STOP THAT "OUT OF OFFICE EMAILS" . 

 

So that i have gone through all "reply" inbound actions in those i got two inbound actions which are mentioned "out of office"

Below are the two inbound actions ..can any one please help which inbound action gets allowed "out of office email" on incident comment. and kindly please update where the issue is......

1.inbound action script(reply)

if (current.sys_domain == '70dbba474f83260003d42dfe0310c753' || current.sys_domain.parent == '70dbba474f83260003d42dfe0310c753') {
current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
current.u_out_of_office_response = true;
if (email.subject.toLowerCase().indexOf("out of office") < 0 && email.subject.toLowerCase().indexOf("automatic reply") < 0) {
current.u_out_of_office_response = false;
current.state = 12;
}
} else {
current.work_notes = email.body_text;
}
current.update();

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

2.inbound action script(reply)

gs.include('validators');

if (current.getTableName() == "incident") {
var gr = current;
if (email.subject.toLowerCase().indexOf("out of office") < 0 && email.subject.toLowerCase().indexOf("automatic reply") < 0) {
gr.order = "";
gr.u_out_of_office_response = false;
gr.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
if (gs.hasRole("itil")) {
if (email.body.assign != undefined)
gr.assigned_to = email.body.assign;

if (email.body.priority != undefined && isNumeric(email.body.priority))
gr.priority = email.body.priority;
}
gr.update();
} else {
var inc = new GlideRecord('incident');
inc.addEncodedQuery("active=true^u_out_of_office_response=false^u_affected_user.email=" + email.origemail);
inc.orderByDesc('sys_created_on');
inc.query();

while (inc.next()) {
inc.u_out_of_office_response = true;
inc.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
inc.update();
}

var req = new GlideRecord('sc_req_item');
req.addEncodedQuery("active=true^u_out_of_office_response=false^request.requested_for.email=" + email.origemail);
req.orderByDesc('sys_created_on');
req.query();

while (req.next()) {
req.u_out_of_office_response = true;
req.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
req.update();
}
}
}

 

4 REPLIES 4

VigneshMC
Mega Sage

This added to email properties by default to ignore OOO emails, check if yours is configured properly

find_real_file.png

amlanpal
Kilo Sage

Hi,

 

I believe this is what you are looking for: 

https://community.servicenow.com/community?id=community_question&sys_id=6cc28761dbd8dbc01dcaf3231f9619fd

 

I hope this helps.Please mark correct/helpful based on impact

Hi Amlanpal,

Very thanks for the immediate response. But here my query is not creating new incident. "out of office" auto rely mails content are being attached/added in the incident comments. But i want to avoid those emails to no make update on the incident comments.

Hi,

 

If you change the property of the incident, any out of box email should get ignored. Or else, for the particular Inbound Action, you can opt for the Inbound Action condition as mentioned in the link which I have shared earlier.

 

I hope this helps.Please mark correct/helpful based on impact