Hey All,
I am working on a JIRA Automation + Power Automate in order to send the count of distinct issues worked on by my squad while closing the Sprint to the Teams in the form of a message on channel or group chat.
JIRA Automation rule sequence:
When: Sprint completed
Then: lookup issues
And: add value to audit log
And: Send Web Request
Add value to Log (Action):
Issue Type: {{fields.issuetype.name}} ; Stories: {{lookupIssues.where("fields.issuetype.name = 'Story'").size}}
Send Web Request: Webhook body (Custom Data)
{
"totalIssues": {{lookupIssues.size}},
"storyCount": {{lookupIssues.where("fields.issuetype.name = 'Story'").size}},
"bugCount": {{lookupIssues.where("fields.issuetype.name = 'Bug'").size}},
"taskCount": {{lookupIssues.where("fields.issuetype.name = 'Task'").size}},
"spikeCount": {{lookupIssues.where("fields.issuetype.name = 'Spike'").size}}
}
-----
So, when my rule is run, i see the the log value as ---> Issue Type: Story ; Stories : 0
Which means, the smart value to calculate the count of issues of type = Story is failing.
I have tried multiple ways with aid of ChatGPT & Copilot, but efforts have gone in vain.
Note: {{issue.issueType.name}} didn't resolve to give me type = Story but {{fields.issuetype.name}} did.
Please help.
#JIRA #JiraAutomation #automation #powerautomate
@LPK Your use case would ideally require a reduce
-like function that can iterate over the lookupIssues
list, filter issues by issueType
, and aggregate the counts. However, such advanced list operations are not currently supported in Jira Automation smart values.
As a workaround, I recommend breaking down your lookupIssues
into separate actions using specific JQL queries for each issue type.
For example, your first Lookup Issues action can use:
project = XYZ AND sprint = {{sprint.id}} AND issuetype = "Story"
Then, add a Create variable action with:
Name: storiesCount
Value: {{lookupIssues.size}}
Repeat this process for other issue types like Bug, Task, and Spike, each with their own Lookup Issues and variable creation steps.
Once done, you can use these variables to construct your output:
"totalIssues": {{#=}}{{storiesCount}}+{{bugCount}}+{{taskCount}}+{{spikeCount}}{{/}},
"storyCount": {{storiesCount}},
"bugCount": {{bugCount}},
"taskCount": {{taskCount}},
"spikeCount": {{spikeCount}}
Amazing! @Akash Singh
I just tried for Issue type = Story. It worked!
So, I will have to perhaps iterate this approach "lookupIssues -> Create a variable (to store the count) for all issue types and then send those smart values to the JSON payload.
I have been banging my head to solve this with an aid of ChatGPT or Copilot.
But you've proved a human is superior to computers at any given point of time :)
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.
Hi @LPK
You may use smart value, list filtering to do this:
https://community.atlassian.com/forums/Automation-articles/Filtering-smart-value-lists/ba-p/1827588
The general approach uses conditional logic to filter by the issue type, and then a wrapped math expression to perform the count. This will be faster than using multiple Lookup Work Items actions, with different JQL expressions, and reduce the chance of errors due to repeating the JQL multiple times.
For example:
Story count: {{#=}}0{{#lookupIssues}}{{#if(equals(issuetype.name,"Story"))}}+1{{/}}{{/}}{{/}}
Bug count: {{#=}}0{{#lookupIssues}}{{#if(equals(issuetype.name,"Bug"))}}+1{{/}}{{/}}{{/}}
...
How that works is...
And, as you are doing this in order to Send Web Request, I recommend pre-building the entire expression's JSON as a variable and then using that in the request. This will help with both performance and debugging of the message.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.