I'm trying to figure out which smart values I can use to get the # of tickets in a certain filter that have priority low, medium, high.
In the atlassian documentation it says this is possible with the ".size" but I can't get that to work.
These smart value keep returning 0. Any ideas?
Hi @Julia
First, a disclaimer: I am using Jira Cloud and not Server / Data Center, so I cannot verify this suggestion.
Your Jira version has bulk operations on {{issues}} for a branch or scheduled trigger, and I believe this will work, where you may change the priority names for your own:
{{issues.priority.name.match("(Highest)").split(",").size|0}}
What this is doing is...
Kind regards,
Bill
I am glad to learn that worked for you! The same technique works for Jira Cloud with Lookup Issues, and it is quite handy for reporting emails send by automation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy
Thank you for being so helpful.
I was wondering how I should use this command
{{issues.priority.name.match("(Highest)").split(",").size|0}}
In case I would like to count two values at the same time.
For example, both "Critical" and "High"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Erez Ben-Or -- Welcome to the Atlassian Community!
When reviewing an older question like this, please create a new question and then provide a link back to the older one for context. Otherwise only the people following this thread will see it. Thanks!
Back to your question...
First, are you using Jira Cloud or Jira Server/Data Center version? Only the automation rules for Server/Data Center have access to the {{issues}} (note the plural) smart value. Jira Cloud instead uses the Lookup Issues action and the {{lookupIssues}} smart value.
Let's assume you are using Server/Data Center...
To get each count, you would need a separate expression for each one, Critical and High. If you wanted their total, you may use a math expression to sum them:
{{#=}}{{issues.priority.name.match("(Critical)").split(",").size|0}} + {{issues.priority.name.match("(High)").split(",").size|0}}{{/}}
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for clarifying the reviewing issue and thank you for the answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Julia
Can you provide the full content of your automation rule, and a link to the document you are referencing when you get information about ".size"? That will help us provide answers relevant to your context.
The "size" property is relevant to have a list of items. There may be other ways to handle this but I would try using the Lookup Issue action to get a list of issues in a given priority and then use {{lookupIssues.size}} to get the number of issues in that list. If you are trying to get the counts for multiple lists into another single action (like Send Mail) you would need to assign the {{lookupIssues.size}} value for each Lookup Issues action to a separate variable, I think, as each LookupIssues action would overwrite the results of the previous action.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
https://confluence.atlassian.com/automation/jira-smart-values-issues-993924860.html
The entire context is this:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for that additional information.
In this scenario you can't use "size" to get a count of a subset of the issues returned by your JQL. You can get a count of all the issues returned by the JQL or a count of the Comments associated to an issue in the list, but not a count of a subset of issues in the results.
You could create multiple scheduled rules, each with a JQL that retrieves the issues for a specific priority, and use {{issues.size}} in a Send Mail action to get the count for issues for that one priority.
Alternately you can do as I suggested before and create multiple Lookup Issues actions, each with a JQL that gets issues for one priority, and collect the size of each result set in a unique variable. Then include all those variables in your Send Mail action. In that scenario you would not have the JQL as part of the Trigger.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, I apologize. I did not notice that your post was tagged for Jira Server. The Lookup Issues action is not available there, but there is a change request for it.
https://jira.atlassian.com/browse/JIRAAUTOSERVER-53
I think then in your scenario you would need to run the JQL per priority in separate rules.
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.