How to drive priority from urgency and impact in a record producer.

Vaishnavi35
Tera Guru

Hi,

 

I have created 3 variables(Impact, Urgency and Priority) in a record producer. 

I want priority to be populated depending upon the Urgency and Impact values. Basically it should drive Priority Matrix( Priority Data Lookup rules) and how it drives on the Incident form in the platform.

 

If anyone can help me with this?

 

Thanks,

Vaishnavi

1 ACCEPTED SOLUTION

praneeth7
Tera Guru

Hi @Vaishnavi35 

 

If you want the priority variable choices has to be set based on the impact and urgency on record producer.

for that you can create two on change catalog client script for same record producer. and choose variable name impact for one CCS and urgency for another CCS. 

Use this same script for both CCS and hope this will help you

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}

//Type appropriate comment here, and begin script below
var impact = g_form.getValue('impact');
var urgency = g_form.getValue('urgency');

// Calculate the priority based on the Impact and Urgency values

if (impact == '1' && urgency == 'a') {
g_form.setValue('priority','critical');
} else if ((impact == '1' && urgency == 'b') ||
(impact == '2' && urgency == 'a')) {
g_form.setValue('priority','high');
} else if ((impact == '1' && urgency == 'c') ||
(impact == '2' && urgency == 'b') ||
(impact == '3' && urgency == 'a')) {
g_form.setValue('priority','moderate');
} else if ((impact == '2' && urgency == 'c') ||
(impact == '3' && urgency == 'b')) {
g_form.setValue('priority','low');
} else if (impact == '3' && urgency == 'c') {
g_form.setValue('priority','planning');
}
}

If you find this useful please mark my answer correct and helpful

Thank you

View solution in original post

7 REPLIES 7

Hi Praneeth,

 

Thank you for the help. But can this be made easier? Like directly getting the values from Table and writing a Reference qual or Variable attributes?

 

Thanks,

Vaishnavi

Hi,

Onchange Client Script,

 

Vaishnavi35_0-1676912095350.png

 

OnLoad Client script,

 

Vaishnavi35_1-1676912133382.png

 

This worked.

 

Thanks & Regards,

Vaishnavi

sjunghare47
Tera Contributor
Write 2 different onChange Client Script for Impact and urgency, same client script for both as below You Can Copy Paste directly only changes the Backend Values of your choices impact, urgency, and Priority Backend values.

function
onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }

      var imp = g_form.getValue('u_impact');
   var urg = g_form.getValue('u_urgency');
   if (imp == '1 - High' && urg == '1 - High') {
       g_form.setValue('u_priority', '5 - Critical');
   } else if (imp == '1 - High' && urg == '2 - Medium') {
       g_form.setValue('u_priority', '1 - High');
   } else if (imp == '1 - High' && urg == '3 - Low') {
       g_form.setValue('u_priority', '2 - Medium');
   } else if (imp == '2 - Medium' && urg == '1 - High') {
       g_form.setValue('u_priority', '1 - High');
   } else if (imp == '2 - Medium' && urg == '2 - Medium') {
       g_form.setValue('u_priority', '2 - Medium');
   } else if (imp == '2 - Medium' && urg == '3 - Low') {
       g_form.setValue('u_priority', '3 - Low');
   } else if (imp == '3 - Low' && urg == '1 - High') {
       g_form.setValue('u_priority', '2 - Medium');
   } else if (imp == '3 - Low' && urg == '2 - Medium') {
       g_form.setValue('u_priority', '3 - Low');
   } else if (imp == '3 - Low' && urg == '3 - Low') {
       g_form.setValue('u_priority', '4 - Planning');
   }
   
}