Hey there community!
Use case:
We are working on an incident process in our jira instance to automatically create a Master Incident ticket when the total number of jira issues with a particular category in JQL search matches a certain value in another custom field.
For example:
Category: System Outage
Category outage value: i.e. 10 (meaning declare an incident if there 10 issues created over the course of n hours)
If 10 jira issues are created or updated and contain the category 'System Outage' then we want to jira to automatically create a Master Incident issue and link all 10 issues to it.
Question:
What is the best approach you would recommend for automating such a thing?
Automation for Jira doesn't seem powerful enough for our needs as the automations run on each issue found in the JQL rather than running an action if the total search results > n (i.e. 10)
Ideally we are looking for Jira (api/script?) to run and count number of open issues (total results perhaps?) with a particular category and then compare the results with the category outage value. If search results >= outage value then create master incident ticket.
Would be great to hear if anyone has done something similar?
All advice much appreciated!!
Thanks
I wasn't sure it could be done with Automation for Jira, but I think I found something that might work for you. I like a challenge!
Here was the test rule I created:
I started with a Scheduled trigger. This avoids the rule being scoped to just one triggering issue. I believe you'll have to run this on a schedule (e.g. once an hour, every 10 minutes, whatever), since any other trigger type will reduce the scope.
Next I used the Lookup Issues action, which was able to execute the JQL globally (outside the scope of a triggered issue). Note that this action has a limit of 100 issues, but since your use-case was in the range of 10 issues, it should work for this.
The compare conditional checks to ensure there were enough results to continue. I used a limit of "greater than 2" for my test. You'd use "greater than 9", since there is no "greater than or equal to 10" option.
The branch/loop repeated the JQL, iterating on a simple Audit Log entry, just to show that it found all the target issues. In my test, three matching issues were noted in the Audit Log:
It is unfortunate that the same JQL needs to be executed twice. You'll probably want to balance the frequency of execution against that overhead. And it's a bit brittle, as both JQL queries have to be kept in sync. However, I think it accomplishes your goal.
Here are a few pointers to related articles and documentation:
I hope that helps!
Thanks so much for taking the time to run through that @Mykenna Cepek
Sadly we are on a server instance (apologies I should've mentioned that at the beginning :facepalm:) so we are missing the lookup functionality that could prove useful for our use case.
Not expecting that feature to make it across to server anytime soon based on the recent Atlassian news :)
Appreciate your input with it but I have a feeling that we may need to look at other options
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Understood - best wishes, @Daniel Smith !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I had a similar need and am working with the cloud version. Your example helped tremendously! @Mykenna Cepek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Daniel Smith ,
what you need can be done via API but I don't know if that's efficient.
1. To check how many issues are created in a given time period you can use GET request to Jira REST API (with no fields in response, just their count)
2. Comparison value triggers script to create issue (POST) with particular attributes.
Set above tool to run every 5 minutes (or so) and that's it.
As I said, I don't know if that's efficient. Checking number of issues is pretty light when no fields are sent back to user.
Best
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.