How to change how priority calculate?

Mytno1
Mega Contributor

I'm working on how to change the way priority calculate. I already know how to change it based on other field, but my boss said he want to take it "dynamic".

I created a field in choice list called [u_important], which value range is from 1-5.

find_real_file.png

 

find_real_file.png

 

Now I want to everytime I change the value of category, the priority change as well (not like newValue =="network" > setValue), more like to get the Value of [u_important] from choice list to change the prority value.

For example, If I choose 'software', the sciprt go to choice list and see the value of u_important is 1, so the priority change to 1 as well.

Whenever I choose another, the priority change equal to the value of u_important.

I'm not good at javascript, thank you.

10 REPLIES 10

Mytno1
Mega Contributor

I haven't figure out how to do with Look up Definition, so how should I code script pls?

Is your priority set based on the value of just one field or is it the result of a calculation of the values of two or more fields?

Mytno1
Mega Contributor

It is based on calculation of >2 field, I plan to do like.. average bettween category and sub category.

Like :

Important value of category : 2

subcatgory1 : 3

=> (2+3)/2 = 2.5 = priority value

If you're matching on 2 or more fields you much better off figuring out data lookups, they're literally designed to do this.

1. create a table with your field values and their corresponding priority, the new table must extend 'Data Lookup Matcher Rules':

find_real_file.png

if you're adding choice fields to this table you can configure them to take their choice values from the tables the data lookup is working on:

find_real_file.png

2. create a definition which correlates the fields on your source table (incident) with the field on your matcher table (the table you created in step 1) . Note there are 2 tabs here, 1 for matcher field and one for setter field eg match impact and severity and set priority.

find_real_file.png

Hope this helps, go through the documentation for further details.

Hi, You don't have to code for this, you need create a data lookup record. Logically it says based on selection of field A and Field B, set Field C. Go through below article to understand in detail https://docs.servicenow.com/bundle/london-platform-administration/page/administer/field-administration/concept/c_DataLookRecMatchSupport.html