The CreatorCon Call for Content is officially open! Get started here.

How to write a client script to calculate impact and urgency so that priority should autopopulate

Himabindu
Giga Contributor

How to write a client script to calculate impact and urgency so that priority should auto populate

1 ACCEPTED SOLUTION

Sample script as below.

find_real_file.png

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

	var getimpact=g_form.getValue('impact'); //replace impact  variable name
	alert('Impact user selected is '+getimpact); //Just for check can be commented
	
	var geturgency=g_form.getValue('urgency'); //replace urgency with variable name
	alert('Urgency user selected is '+geturgency); //for check can be commented
	
	if(getimpact=='high' && geturgency=='high')
		{
			g_form.setValue('priority','high'); //replace priority with variable name & set the value as high
		}
	
	
   //Type appropriate comment here, and begin script below
   
}

 

Note: You need to create 2 one for impact & other for urgency & replace variables & values accordingly.

View solution in original post

9 REPLIES 9

Sample script as below.

find_real_file.png

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

	var getimpact=g_form.getValue('impact'); //replace impact  variable name
	alert('Impact user selected is '+getimpact); //Just for check can be commented
	
	var geturgency=g_form.getValue('urgency'); //replace urgency with variable name
	alert('Urgency user selected is '+geturgency); //for check can be commented
	
	if(getimpact=='high' && geturgency=='high')
		{
			g_form.setValue('priority','high'); //replace priority with variable name & set the value as high
		}
	
	
   //Type appropriate comment here, and begin script below
   
}

 

Note: You need to create 2 one for impact & other for urgency & replace variables & values accordingly.

@Himabindu Just to check did you mistakenly mark other answer as correct as it seemed you had marked some other answer correct.

Note: You can have only 1 answer correct so mark the one that helped & should help future readers.

Sir , what about the impact -1 & urgency 2 for getting priority 2...like that remaining value s as imp-1&urg 2 for pri-3 like that please give answer

  •  

Ankur Bawiskar
Tera Patron
Tera Patron

@Himabindu 

For this you would require onChange client script on both the variables

1) Impact

2) Urgency

Regards
Ankur

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

Hi Ankur, need some information can you message to my my id please. ranjithparam99@gmail.com