Priority default value changes

nomadie
Kilo Expert

Hi, I need help with this simple requirement but appears to be tricky.

I only need to change the default value of the Priority field in the the Change module from 4 to 3 for Normal and Standard.

First I used UI Policy setting condition to type != emergency and use advance script to setvalue of the priority field to 3.
Result: on load for create new it works fine, however, when I open an existing change record it also changes to 3. 

Second I used Client Script with onLoad type and using the same condition.
Result: is the same with the 1st configuration.

Third I used Dictionary override on Priority. The result works fine this time for existing records, but the problem is I cannot add the condition to only run for Normal and Standard.

Anyone here who happens to pin point what is wrong with my work? Thank you.

1 ACCEPTED SOLUTION

Oh yes, you can add a check for New Record.

var type = g_form.getValue("type");
if(g_form.isNewRecord()){
if(type== "normal" || type== "standard"){
  g_form.setValue("priority", 3);
}else{
  g_form.setValue("priority", 4);
}
}

View solution in original post

12 REPLIES 12

Alikutty A
Tera Sage

Hello,

You could make it a calculated field under dictionary override on the task table.

The following script can be tried out, change values accordingly

if(current.type== "normal" || current.type== "standard")
return '3'; 
else
return '4';

this didn't work

You can write an insert business rule on change_request table with the same script. This will again support for standard changes along with others. Can you try?

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

if(current.type== "normal" || current.type== "standard")
current.priority = 3;
else
current.priority = 4;
})(current, previous);

it still didn't work. tested this in my personal instance sadly didn't work