For every 30 reopen count in incidents create a new problem ticket

mirza_saquib
Tera Contributor

As reopen count of incidents are increasing again and again and i need to create a problem ticket for every 30 reopen incident, that is the reopen count reaches 30 it create one problem ticket. When the same event comes again then the new event create and the reopen count in that incident reaches 30 new problem ticket create and the same is going on , please suggest any flow or something which helps to resolve the issue.

1 ACCEPTED SOLUTION

Pratiksha2
Mega Sage

Hello @mirza_saquib -
You can write after update Business rule ,

 

(function executeRule(current, previous /*null when async*/) {
    // Check if the incident has been reopened
    if (current.state == 2 && previous.state == 7) {
        // Increment the reopen count
        var reopenCount = current.reopen_count ;

        // Check if the reopen count is a multiple of 30
        if (reopenCount % 30 === 0) {
            // Create a new problem ticket
            var problemGr = new GlideRecord('problem');
            problemGr.short_description = 'Auto-generated problem ticket for multiple incident reopens';
            // Add any additional fields as needed
            var problemSysId = problemGr.insert();

            gs.info('Created a new problem ticket with Sys ID: ' + problemSysId);
        }
    }
})(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,

Pratiksha

View solution in original post

8 REPLIES 8

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

Out-of-the-box, there is a field reopen count. You could create a flow which triggers on the reopen count. Have you tried that? Sounds like zero code involved.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi @Mark Roethof,

I tried that functionality. I can create a problem ticket using flow , but when the problem resolved incident closed and if same event trigger again it will create new incident and repeates the same process. I am unable to perform this highlighted part.

Thanks & Regards

Mirza Saquib Beg

Please share what you tried, perhaps a small mistake you made.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Rahul Priyadars
Giga Sage
Giga Sage

You Can Write a Flow or BR when Reopen_Count>=30

 

 

Table: incident

 

Advanced: true

 

Update: true 

When: After

 

conditions: current.reopen_count>=30

 

Script:

 

var prb = new GlideRecord('problem');

prb.newRecord();

prb.short_description = current.short_description;

// copy other fields here as needed

prb.insert()

 

Regards

RP