Created a business rule to update ticket status to P2 doesn't work

RudyS
Tera Expert

Hi everyone,

 

I created a business rule to update certain incoming tickets status to P2, but it doesn't work.

Appreciate any help on this. This is the code I use in the business rule:

 

(function executeRule(current, previous /*null when async*/) {
    // Check if the priority is not already set to 2
    if (current.priority != 2) {
    // Set the priority to 2
    current.priority = 2;
    }
})(current, previous);
 
 --------
This is the conditions I use as well.
RudyS_0-1746476442458.png

 

2 ACCEPTED SOLUTIONS

J Siva
Tera Sage

Hi @RudyS 
You cannot set the priority value directly, as it depends on the 'Urgency' and 'Impact' fields. Therefore, instead of updating the priority value, adjust the impact and urgency values as needed.

In OOB configuration, if Impact is 1 and Urgency is 2, or vice versa, the priority will be updated as 2-High.

(function executeRule(current, previous /*null when async*/ ) {
    if (current.priority != 2) {
        current.impact = 2;
        current.urgency = 2;
    }
})(current, previous);

Regards,
Siva

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@RudyS 

I agree with @J Siva

Just set the impact and urgency and the priority matrix will set the Priority and this is the OOTB platform behavior.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

4 REPLIES 4

J Siva
Tera Sage

Hi @RudyS 
You cannot set the priority value directly, as it depends on the 'Urgency' and 'Impact' fields. Therefore, instead of updating the priority value, adjust the impact and urgency values as needed.

In OOB configuration, if Impact is 1 and Urgency is 2, or vice versa, the priority will be updated as 2-High.

(function executeRule(current, previous /*null when async*/ ) {
    if (current.priority != 2) {
        current.impact = 2;
        current.urgency = 2;
    }
})(current, previous);

Regards,
Siva

Ankur Bawiskar
Tera Patron
Tera Patron

@RudyS 

I agree with @J Siva

Just set the impact and urgency and the priority matrix will set the Priority and this is the OOTB platform behavior.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

RudyS
Tera Expert

Thank you Siva and Ankur. 

Your solution worked. I'm not sure how I missed that 😊.

@RudyS Glad it helped