ServiceNow developer

Moutushi Ghosh1
Tera Contributor

Can we make all incident tickets that are marked as P1 automatically generate a Problem ticket? likewise we want all incident tickets to default to P3's. Kindly help

2 REPLIES 2

Anand Kumar P
Giga Patron
Giga Patron

Hi @Moutushi Ghosh1 ,

Create new business rule on incident table set condition as priority p1 and add below script in advanced tab

 

(function executeRule(current, previous /*, other_glide_object*/) {
    if (current.priority == '1') {
        var problem = new GlideRecord('problem');
        problem.initialize();
        problem.short_description = current.short_description;
        // add what all fields copy from incident to problem
        problem.insert();
    }
})(current, previous);

 

To update all incident state to p3 use below script.

 

var incidentGR = new GlideRecord('incident');
incidentGR.addQuery('active', true);
incidentGR.query();
while (incidentGR.next()) {
incidentGR.impact='2';
incidentGR.urgency='2';
    incidentGR.priority = '3'; 
    incidentGR.update(); 
}

 

Please mark it as solution proposed and helpful.

Thanks,

Anand

 

Tai Vu
Kilo Patron
Kilo Patron

Hi @Moutushi Ghosh1 

#Auto Create Problem Ticket for Incident P1

You can mimic the OOTB function from the UI Action "Create Problem".

  1. Create a Business Rule After Insert/Update
  2. Conditions: Priority changes to 1 - Critical
  3. In Advanced Script, copy the OOTB function to it.
var prob = new IncidentUtils().getProblemFromIncident(current);
if (prob != undefined) {
    current.problem_id = prob.insert();
}

This script above from the OOTB UI Action.

Name: Create Problem

URL: https://<instance_name>/sys_ui_action.do?sys_id=2f43c471c0a8006400a07440e49924c2

 

#Incident Default P3

The Incident Priority is managed through Impact and Urgency. The Priority Matrix is defined in the below table [dl_u_priority]

URL: https://<instance_name>/dl_u_priority_list.do?

 

So, what needs to be done is that you need to re-define the Default Value of Incident Impact, Urgency and Priority in the Dictionary Override, which is corresponding with the Priority Matrix above.

 

Let me know if it works for you!

 

Cheers,

Tai Vu