parent child incident including client script display message

Within IT Service Management and especially within Incident Management you often see the case that you have multiple calls or inquiries regarding the same issue. In Incident Management there is an option that you can build a parent/child relationship between those incidents. This has multiple benefits:

  • Have one parent incident that can be updated to send updates to all child incidents
  • Resolve parent incident resolves all child incidents
  • Customers are updated with the same content from the parent incident
  • Service Desk people can focus on collecting child incidents and resolve only the parent incident instead of wasting time updating multiple incidents

How to set up Parent/Child incident functionality

The functionality is already built into the system and can be used right away. Therefore the maximum you have to do is to place the parent incident field somewhere on the incident form and show the related list for Child incidents.

This is all you have to do to start working with the functionality. But if you invest some more time you can even make it easier for the Service Desk to identify at one glance if they work on the parent or the child incident (which is a little bit unclear if they do not always look at the parent incident field).

Create an onLoad script to show if parent or child

With a simple onLoad script and a System UI message, you can make the lives of Service Desk agents and all others who work with incident management easier. With these two methods, you can display a message wherever you want on the form to give the fulfillers a quick overview of what they are working on.

Why use messages instead of writing the message in the code directly?

Well… there are two reasons for this:

  1. If you have to support multiple languages you have to use messages that get pulled automatically based on the language of the fulfiller and if they are maintained.
  2. You don’t want to adjust the scripting code all the time you need to adjust the displayed message. It is much easier just to load a message instead of scrolling through multiple lines of code (especially for non-developers).

How to create the System UI messages?

  1. Navigate to System UI > Messages.
  2. Click New.
  3. Enter a Key.
  4. Select language.
  5. Enter your message text.
  6. Repeat with other languages, make sure the key stays the same.
System UI Message – Child Incident

How to create the onLoad script to display the message?

The code is quite simple to load the messages for parent and child incidents. There is some help on how to call a message within scripts by ServiceNow, but if you want just to know how to display the message in this example you can use the code below in your onLoad client script.

function onLoad() {
   //Type appropriate comment here, and begin script below
   
        //Shows message if this is a parent incident

	if (g_form.getValue('child_incidents')>0){
		g_form.showFieldMsg('number', getMessage('tlgr.incident.parent'), 'info');
	}
	
	//Shows message if this is a child incident

	var parent = g_form.getValue('parent_incident').length;
	if (parent > 0){
		g_form.showFieldMsg('number', getMessage('tlgr.incident.child'), 'warning');
	}
}

The result will look like this for your fulfillers. Of course, you can decide if you want to bind the message to a field or have it displayed at the top. My experience is that messages at the top get less notice as people get used to the OOTB messages which pop up there, so if you point your message somewhere else your fulfillers will recognize it better.

Leave a Comment