Automation to populate a % complete field to match progress in Jira

Anuradha Yadav October 28, 2024

Hi Team,

we are writing Jira automation for below, could you please help?

we are Testing to see if we can populate a % complete field to match progress in Jira.

 

image.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.png



we are facing some errors:

 

 

Unknown unary operator * at character position 6: 0 / * 100

 

1 answer

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 28, 2024

Hi @Anuradha Yadav 

Please see this article describing how to use smart value, list filtering: https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588

As some examples of how to do this operation in one expression...

Percentage complete by count, rounded to whole numbers:

{{#=}}ROUND( ( 0{{#lookupIssues}}{{#if(equals(status.statusCategory.name,"Done"))}}+1{{/}}{{/}} ) / {{lookupIssues.size|0}} * 100, 0){{/}}

 

Percentage complete by story points, rounded to whole numbers:

{{#=}}ROUND( ( 0{{#lookupIssues}}{{#if(equals(status.statusCategory.name,"Done"))}}+{{Story points|0}}{{/}}{{/}} ) / {{lookupIssues.Story points.sum|0}} * 100, 0){{/}}

 

Those expressions use list iterators, list filtering, and math expressions to accumulate the "Done" issue values and then divide them by the total, before rounding the result.

 

Kind regards,
Bill

Anuradha Yadav October 29, 2024

@Bill Sheboy  Thanks for the response, but still I didnt not understand it.

Do  you mean I should add only one step for the % calculation?

'"

Percentage complete by count, rounded to whole numbers:

{{#=}}ROUND( ( 0{{#lookupIssues}}{{#if(equals(status.statusCategory.name,"Done"))}}+1{{/}}{{/}} ) / {{lookupIssues.size|0}} * 100, 0){{/}}

 

"

but in the screenshots I shared, what is the mistake?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 29, 2024

Yes, you could use that expression I provided to calculate the percentage in one step to set the field.

 

I have not seen the .filter() syntax documented as an automation feature and so that appears to be one of the problems:

-- This does not work:

{{lookupIssues.filter(status = "Done").size}}

 

Instead use this to count the done issues:

{{#=}}0{{#lookupIssues}}{{#if(equals(status.name, "Done"))}}+1{{/}}{{/}}{{/}}

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events