Propose Major Incident UI Page Client Script

Emelia Langa1
Kilo Explorer

Good Day, 

We enabled ServiceNow's major incident plugin and notice that the "Propose Major Incident" functionality brings up a pop-up to update the Business Impact and Work Notes.

We have changed this to instead display the Incident Impact and Urgency fields as well as the Work Notes. This is to ensure that the support person proposing the major incident is reviewing and updating the Impact and Urgency. This works well, however, with our focus to only have Priority 1 and Priority 2 incidents proposed as a major incident, we are not able to limit the Impact and Urgency drop-down selections to include only the selections that calculate to a Priority 1 & Priority 2.

We need assistance and guidance on how to limit the Impact and Urgency drop-down selections which are displayed on the pop-up to only show specific selections and make this fiels mandatory.

We tried using client script and UI Page client script but both scripts are not working.

 

Regards;

Emelia Langa

1 ACCEPTED SOLUTION

Took me a while, but I think I have it.

Change this:

if(!config.workspace) {
			dialog = GlideModal.prototype.get("sn_major_inc_mgmt_mim_propose");

          var currentWorkNotes = dialog.getPreference('WORK_NOTES');
          if(currentWorkNotes) {
              workNotes.value = currentWorkNotes;
              workNotesOnChange();
          }
          var currentImpact = dialog.getPreference('IMPACT');
          if(currentImpact)
              Impact.value = currentImpact;
			var currentUrgency = dialog.getPreference('URGENCY');
          if(currentUrgency)
              Urgency.value = currentUrgency;
        }

 

To this:

if (!config.workspace) {
			dialog = GlideModal.prototype.get("sn_major_inc_mgmt_mim_propose");

			var currentWorkNotes = dialog.getPreference('WORK_NOTES');
			if (currentWorkNotes) {
				workNotes.value = currentWorkNotes;
				workNotesOnChange();
			}
			var currentImpact = dialog.getPreference('IMPACT');
			if (currentImpact) {
				var impactValuesToRemove = ['5', '4', '3'];//remove impact value 3,4,5 
				Impact.value = currentImpact;
				for (var i = 0; i < Impact.length; i++) {
					if (impactValuesToRemove.indexOf(Impact.options[i].value) != -1)
						Impact.remove(i);
				}
			}
			var currentUrgency = dialog.getPreference('URGENCY');
			if (currentUrgency) {
				var urgencyValuesToRemove = ['5', '4', '3'];//remove impact value 3,4,5 
				Urgency.value = currentUrgency;
				for (var i = 0; i < Urgency.length; i++) {
					if (urgencyValuesToRemove.indexOf(Urgency.options[i].value) != -1)
						Urgency.remove(i);
				}
			}
		}

View solution in original post

7 REPLIES 7

Hi Willem, 

 

Thank you for your response we are able to remove the values. Now we able to make this choice field mandatory using below code. Please assist


<g:ui_choicelist name='Urgency' table='incident' field='urgency' mandatory= true/>

 

 

It might be best to create a new question for this. Others can join in as well.

You can try:

<g:ui_choicelist name='Urgency' table='incident' field='urgency' mandatory='true'/>

@Willem ,   Thank you  alot. Okay I will create a new question for this