Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Auto create a problem if Major incident is resolved

sattar3
Tera Contributor

Hello Everybody,

 

The requirement is when a Major incident is resolved then automatically a Problem ticket.

 

I created a BR to implement this but it is working sometime and sometimes not working.

Please check the below script and let me know if any changes needed.

 

I installed the Major Incident Management Plugin also.

One more thing is do i need to use Major Incident Management application scope or Global scope also fine?

 

BR Script: After Update 

(function executeRule(current, previous /*null when async*/) {

    // Short Description, Problem Manager Assignment Group, and Responsible IT Organization to populate with the corresponding information from the Incident Record.  
    var problemGR = new GlideRecord('problem');
        problemGR.initialize();
        problemGR.short_description = "RCA for Major Incident " + current.number;
        problemGR.description=current.close_notes;
        problemGR.assignment_group=current.assignment_group;
        problemGR.cmdb_ci=current.cmdb_ci;
        problemGR.insert();
        current.setValue('problem_id', problemGR.number);
        gs.addInfoMessage("Problem " + problemGR.number + " created from this Major Incident.");

})(current, previous);

Thanks,
Sattar

 

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@sattar3 

it already happens if you resolve P1 or P2 INC

Problem is OOTB created when a major INC is Resolved.

I shared the details few months ago how and from where it's created.

You can tweak the OOTB Flow Action "Create Problem Record from Incident" and the Script Step to add/remove the new fields.

sharing the link where I responded earlier

Automatic problem record is getting created when M1/M2 incident getting resolved 

AnkurBawiskar_0-1765513203061.png

 

 

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@sattar3 

if you are still using that custom BR then update this line

I hope your BR condition is proper

current.setValue('problem_id', problemGR.sys_id); // you should set sysId here and not number

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader