I'm trying to create a Smart Value that totals the number of issues that contain multiple Sprint Values from a JQL query.
Purpose is to calculate number of rollover tickets from the previous month for a report.
I don't have the option of installing or using addons so limited to a solution of base Jira.
Been working on this and best I could think of is the below template..
{{lookupIssues.[issues with multiple sprint values].size}}
Any suggestions would be appreciated.
Hi @Aaron D -- Welcome to the Atlassian Community!
In my opinion, this is a bit challenging in rules: the sprint field can behave like a single value, a list, or an array...apparently based on context.
Here is an approach I believe works:
{{#=}}0{{#lookupIssues}}{{#if(sprint.join("~").split("~").size.gt(1))}}+1{{/}}{{/}}{{/}}
How this works (with documentation links added):
One would think the join("~") is not needed, and that we could just count the sprints. Yet testing shows some "fuzzy" behavior, forcing us to explicitly create a list with which to count entries.
Kind regards,
Bill
Appreciate the help Bill. Unfortunately no success on my end. Did try other clever ideas like trying to join the string values and using length as a deciding value if to add to the count. But no luck.
I think the limitation might be with the sprint variable being limited to just triggers based off Sprint Values
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you using Jira Cloud, Server, or Data Center version?
Would you please post an image of your complete rule, and audit log details, for some context?
The example I provided definitely works in a rule with any trigger for Jira Cloud, as it uses the result of a lookup issues action, not for a sprint from a sprint-related trigger.
And...context is key for smart values:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm on the Server version and unfortunately unable to share a screenshot.
When running the rule it is returning the value "0" but the true return value should be "2". Audit log is returning success with no error messages for me to see.
Testing the greater than value using .gt(0) still will return a "0" value.
Will the value code change using a Jira Server version?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Some things are the same and some are different for Jira Cloud versus Server versions of automation rules. I am using Jira Cloud and so cannot experiment directly with the expressions.
Let's try breaking this down into pieces. To go faster, I recommend creating a separate, scheduled-trigger rule, with only the lookup and a write to the audit log. That can be called manually for testing.
First, let's confirm what is in the sprint field when there are multiple sprints. Please try writing these to the log:
{{#lookupIssues}}{{key}}:{{sprint}}; {{/}}
What we expect to see is a list of keys and sprints, for example such as this:
ABC-123:sprint 1, sprint 2; ABC-456:sprint 3; ABC-789:sprint 2; sprint 4; ABC-222:;
Then try checking the counts:
{{#lookupIssues}}{{key}}:{{sprint.size}}; {{/}}
What we expect to see for that one is:
ABC-123:2; ABC-456:1; ABC-789:2; ABC-222:;
The last example as no sprints, and so the size will be null.
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.