Calculating the priority from the urgency and severity

ITIL defines the priority of an incident as the sum of the urgency and the severity minus one:
Priority = Urgency + Severity -1

We have already seen how to do simple arithmetic calculations (see Adding attributes together), so we can design a calculation to determine a numeric value for the priority based on numeric values for the urgency and the severity. Create three numeric attributes on Incident, called Urgency, Severity, and Priority, and then add the following calculation to the Priority attribute:

import System
static def GetAttributeValue(Incident):
	Value = Incident._Urgency + Incident._Severity – 1
		return Value

You can then add Urgency, Severity, and Priority to your Incident window, and the calculation will determine a numeric value for your priority.

However, you can change these attributes to use ordered lists containing different named values. You could have Urgencies and Severities called High, Medium, and Low (ranked 3 to 1), and five Priorities called Priority 1 (the highest priority, ranked 5) through Priority 5 (the lowest priority, ranked 1):

Severity

Name

Rank

 

High

3

 

Medium

2

 

Low

1

Urgency

Name

Rank

 

High

3

 

Medium

2

 

Low

1

Priority

Name

Rank

 

Priority 1

5

 

Priority 2

4

 

Priority 3

3

 

Priority 4

2

 

Priority 5

1

The Priority is then determined from the Urgency and Severity according to the following table:

 

 

Severity

 

 

High

Medium

Low

Urgency

High

Priority 1

Priority 2

Priority 3

Medium

Priority 2

Priority 3

Priority 4

Low

Priority 3

Priority 4

Priority 5

For example:
Severity Medium = rank 2
Urgency Low = rank 1
Therefore, Priority rank = 2 + 1 - 1 = 2
and then Priority rank 2 = Priority 4

This example uses the Incident Urgency and the Severity ranked objects that are provided in the Incident Management module to calculate a rank that will be used to determine the value for a new ranked attribute called Calculated Priority, which we will create in the Incident Management module.

There are three steps to this calculation:

  1. Create the new ranked object, relate it to Incident, and populate it. We recommend that you do not use the Attribute Creation Wizard for this, so that you have more control over naming conventions.
  2. Add the calculation to the new ranked object.
  3. Add the controls to the Incident window.
To create the new ranked object:
  1. In Object Designer, click the Incident Management module in the Business Objects tree, then click New Business Object in the Actions list.
    The Behavior Selection message box appears, asking if you want to specify a behavior.
  2. Click Yes.
    The Behavior Selection dialog appears.
  3. In the Available Items list, click Ranked (Creation Only), then click .
    Ranked (Creation Only) moves to the Selected Items list.
  4. Click OK.
    The New Business Object is created.
  5. In the Properties grid, type a Title of Calculated Priority, then click .
    You are asked if you want to create a Name attribute.
  6. Click Yes.
    The Calculated Priority object is saved. Notice that its name is _CalculatedPriority - we will use this later. Also, notice that a Rank attribute is added. Now we need to relate this object to the Incident object.
  7. In the Business Objects tree, drag Calculated Priority object onto the Incident object.
    You are asked if you want to be able to access all related instances of Incident from Calculated Priority.
  8. Click No.
    The relationship is created. In the Attributes tree for Incident you can see Calculated Priority.
  9. Click .
    The object is saved. Now we need to create a window for the object, and then create the values using the Administration component.
  10. In Window Manager, create a new window for Incident Management\Calculated Priority, adding justName.
  11. In the Administration component, display the Ordered Lists tree, then create five Calculated Priority values.

Now we can add the required calculation to the Calculated Priority attribute on the Incident object. This calculation reads the required value from the Calculated Priority ordered list.

To add the calculation:
  1. In Object Designer, open the Incident Management\Incident object, then click Calculated Priority.
  2. In the Properties grid for Calculated Priority, set Calculation Type to BeforeSave.
    The Edit Formula for Calculated Priority appears.
  3. In the Editor box, change the calculation to:
import System
static def GetAttributeValue(Incident):
	if Incident._IncidentUrgency == null:
		return null
	if Incident.Severity == null:
		return null
	Value = Incident._IncidentUrgency.Rank + Incident.Severity.Rank - 1
		return Incident.GetRankedObject("IncidentManagement._CalculatedPriority", Value)
  1. Click Test Syntax to confirm that the calculation contains no errors in its structure, then click OK.
    The Calculation is added to the attribute.
  2. Click .
    The changes are saved.

The lines if... and return null set the value of Calculated Priority to null (blank) if either of the Severity or Urgency lists are cleared - otherwise the previously calculated value for Calculated Priority would remain.
The final line return Incident.GetRankedObject("IncidentManagement._CalculatedPriority", Value) returns the name of the Calculated Priority that corresponds to the calculated rank Value.

The final stage is to add the controls to the Incident window.

To add the controls to the window:
  1. In Window Manager, open the Incident window and add the fields Incident Urgency, Severity and Calculated Priority.
  2. In the Properties grid for Incident Urgency and Severity, set Is calculate on change to True, then save the window.
    When you log an incident and complete the Incident Urgency and Severity fields, the Calculated Priority field automatically completes with the appropriate value.