My company has recently had a case when we needed to derive a priority using a rather complex Impact / Urgency matrix.
There is always a way to create a long-running set of if-else conditions in the automation, however, depending on the complexities in your impact/urgency definitions, this set can be really long (hard to maintain) and can exceed the maximum allowed number of components in the automation. And you will need to create a number of these automations to finish this task.
We have come up with an approach where only 5 components are required to derive the priority of the "unlimited number" of impact/urgency combinations.
Jira stores priorities in a format of id/name pairs.
For simplicity, I will be referring to the priorities in this post by numbers, where
A similar approach applies to two custom fields we have created for urgency and impact, where these fields can be either of these values
As you can see - impacts and urgencies values are prefixed by a number which makes it easier to operate within the automation later.
Below is the sample matrix of impact and urgency resulting in the priority.
The priority value is shown by colour, where red - priority is 1, orange - 2, yellow - 3, and green - 4.
It is possible you might have other priorities like 5, and 6 - but it does not matter, since the approach will work for any number of.
The numbers in the coloured cells are sequential and serve a purpose to "address" the priority value in the list of priorities which can be defined as a priority sequence:
(total 16 elements with 0 based index)
To get the "address" of the priority we need to use the following formula:
(Impact+Urgency) + ((Impact-1) * (NumberOfColumns-1)) - 2
Where NumberOfColumns represents the number of Urgency values, in our case we have 4.
Impact = 3
Urgency = 2
priorityAddress = (3+2) + ((3-1) * (4-1)) - 2 = 5 + (2 * 3) - 2 = 9
9th address in the prioritySequence above is 2 (2 - High) - orange colour
sequence: 1 1 2 3 1 2 3 4 1 2 3 4 2 3 4 4
address : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
The whole automation to calculate the priority consists of a trigger, issue scope and 5 components:
There are few things to note:
I hope the above post will help someone to limit the number of automations, components inside the automation in their JSM implementations.
This approach can be used for defining some additional logic for your automations, since the addressed cell values, can be a "trigger" or business rule "input" into your if/else branches - extending the logic of automations.