Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

add option to impact and urgency fields

arangi naresh1
Kilo Explorer

when we select category has inquiry then remove choice 1-high from impact and urgency fields, if we change category from inquiry to other then choice 1-high should display from impact and urgency fields...

1 ACCEPTED SOLUTION

Great to hear that.

@arangi naresh Can you please mark the answer as correct as well and close this thread for others.

Regards,

Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

4 REPLIES 4

arangi naresh1
Kilo Explorer

we tried  this but there is no result

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var cat = g_form.getValue('category');
if (cat == 'inquiry') {
g_form.setDisplay('subcategory', false);
g_form.removeOption('impact', 1);
g_form.removeOption('urgency', 1);
g_form.showFieldMsg('impact', 'low impact is not prefering high priority', 'error', true);
} else {
g_form.setDisplay('subcategory', true);
g_form.addOption('impact', 1);
g_form.addOption('urgency', 1);
g_form.hideFieldMsg('impact');


}


}

shloke04
Kilo Patron

Hi @arangi naresh 

You need to have an On Change Client script on Category field and update it as below:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
	if(newValue == 'inquiry'){
		g_form.clearOptions();
		g_form.addOption('impact','2','2 - Medium');
		g_form.addOption('impact','3','3 - Low');
		g_form.addOption('urgency','2','2 - Medium');
		g_form.addOption('urgency','3','3 - Low');
		
	}else{
		g_form.clearOptions();
		g_form.addOption('impact','1','1 - High');
		g_form.addOption('impact','2','2 - Medium');
		g_form.addOption('impact','3','3 - Low');
		g_form.addOption('urgency','1','1 - High');
		g_form.addOption('urgency','2','2 - Medium');
		g_form.addOption('urgency','3','3 - Low');
	}

   //Type appropriate comment here, and begin script below
   
}

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

its working..thankyou

Great to hear that.

@arangi naresh Can you please mark the answer as correct as well and close this thread for others.

Regards,

Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke