Incident should be closed immediately once it's created if a short description contains "xxxxxxxxxx"

Nagurbee1
Tera Contributor

Hi Team

Recently I got a one requirement that Incident should be auto closed immediately once it's created if a short description contains "xxxxxxxxxx" and watch list contains "xxxx email id" and assignment group is "xxxx".

In my instance , every day one incident is getting created and auto assigning to a group "xxxx", so "xxxx" group people requested us be auto close it immediately once it's created in ServiceNow as they don't that ticket any more.

 

Could you please suggest that how to auto close the incidents if the above conditions are met ?

 

Thanks in advance

Nagurbi

1 ACCEPTED SOLUTION

Hi @Nagurbee1 

 

Probably, it's a flow then which is creating the incident on the reception of email. Search for flows with trigger type as email and check. Also, creating a before insert business rule on the incident table should do the trick as you are restricting the insert operation itself which is independent of the source.

 

For the issue with selecting a dynamic watch list recipient, can you please confirm if you have an account created for the DL in your instance. If not, then we need to script the condition to check Watch List users. 

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

View solution in original post

13 REPLIES 13

Hi @Nagurbee1 

 

Probably, it's a flow then which is creating the incident on the reception of email. Search for flows with trigger type as email and check. Also, creating a before insert business rule on the incident table should do the trick as you are restricting the insert operation itself which is independent of the source.

 

For the issue with selecting a dynamic watch list recipient, can you please confirm if you have an account created for the DL in your instance. If not, then we need to script the condition to check Watch List users. 

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Hello Amit

I have created a before insert business rule and it worked.

Thank you so much for your help 🙂 and I am accepting your solution.

 

Thank you

Nagurbee

Maddysunil
Kilo Sage

@Nagurbee1 

You can write Before Insert BR, Below is the code:

 

(function executeRule(current, previous /*null when async*/) {
    if (current.short_description.includes("xxxxxxxxxx") &&
        current.watch_list.toString().includes("xxxx email id") &&
        current.assignment_group == "xxxx") {
        current.state = 7; // Set state to "Closed"
        current.close_code = "Auto-closed";
        current.comments = "Incident auto-closed as per request.";
        current.update();
    }
})(current, previous);

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks

no code needed for this... @Amit Verma  has recommended the right and lowcode approch


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect