Context Resolution Algorithm
Context Resolution Algorithm
There may be multiple contexts applicable to an issue. The best-matching context is selected for each issue to determine the email template or notification rules that apply to that issue.
Contexts are resolved from the strongest to the weakest match. Here are the steps performed:
Find all Contexts that are configured with a project and an issue type, and iterate through each of them in the order of the Order attribute (see above):
if the Context that is being evaluated has a JQL filter, check if the Issue matches it. If so, we stop processing and use the Context.
If the Context that is being evaluated does not have a JQL filter, we stop processing and use the Context.
If no Context has been found in the previous step, find all Contexts that are configured with an Issue Type but not with a Project, and iterate through each of them in the order of the Order attribute (see above):
if the Context that is being evaluated has a JQL filter, check if the Issue matches it. If so, we stop processing and use the Context.
If the Context that is being evaluated does not have a JQL filter, we stop processing and use the Context.
If no Context has been found in the previous step, find all Contexts that are configured with a Project but not with an Issue Type, and iterate through each of them in the order of the Order attribute (see above):
if the Context that is being evaluated has a JQL filter, check if the Issue matches it. If so, we stop processing and use the Context.
If the Context that is being evaluated does not have a JQL filter, we stop processing and use the Context.
If no Context has been found in the previous step, find all Contexts that are not configured with an Issue Type or a Project, and iterate through each of them in the order of the Order attribute (see above):
if the Context that is being evaluated has a JQL filter, check if the Issue matches it. If so, we stop processing and use the Context.
If the Context that is being evaluated does not have a JQL filter, we stop processing and use the Context.
If no Context has been found in the previous steps, use an implicit default Context.
Examples
This is how contexts are evaluated based on how well they match an issue:
Context 1
Example Service Management Project
Bug
resolution IS EMPTY
Context 2
Example Service Management Project
Bug
priority = Blocker
Context 3
Example Service Management Project
(empty, i.e. applies to all types)
priority = Critical
Context 4
Example Service Management Project
(empty, i.e. applies to all types)
(empty)
Context 5
(empty, i.e. applies to all projects)
New Feature
(empty)
Context 6
(empty, i.e. applies to all projects)
(empty, i.e. applies to all types)
priority = Critical
Context 7
(empty, i.e. applies to all projects)
(empty, i.e. applies to all types)
(empty)
Some examples of contexts are evaluated for an issue:
Project: Example Service Management Project
Type: Bug
Priority: Normal
Unresolved
Context 1
All attributes are directly matching the Context's settings: it's in the right project, has the correct issue type, and the resolution is empty.
Project: Example Service Management Project
Type: Bug
Priority: Normal
Resolution: Fixed
Context 4
Context 1 does not match the issue as it is resolved (resolution is NOT empty).
Context 2 does not match the issue as it is of Normal priority (not blocker).
Context 3 does not match the issue as it is of Normal priority (not critical).
Context 4 matches the issue, because the issue is in the correct project, the context is applicable to ALL issue types and there is no JQL to put any restrictions on the issue.
Project: Internal IT Project
Type: Bug
Priority: Critical
Resolution: Fixed
Context 6
Context 1-4 does not match the issue as the issue is in the Internal IT Project not the Example Service Management Project.
Context 5 does not match the issue as it is a Bug, not a New Feature.
Context 6 matches the issue as it is of Critical priority and both the project and issue type settings are empty, meaning that they are applicable to all projects and issue types.
Project: Internal IT Project
Type: Task
Priority: Minor
Resolution: Fixed
Context 7
Context 1-6 does not match the issue as it is not fulfilling the Context attributes (the issue isn't in the Example Service Management Project, it is not a new feature, its priority is not critical).
Context 7 matches the issue as the Context does not have any restrictions at all.
Last updated