Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Help needed with updating a user story custom field via an automation rule

Greg Aurand
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 14, 2025

I created a custom field named % complete to our User Stories.  I'm attempting to update % complete to the number of sub-tasks with a status of "done" (statusCategory.key = "done") divided by the total number of sub-tasks each time a sub-task is updated.

 

I can calculate the number of sub-tasks but when it comes to determining the number of "done" sub-tasks I always get a value of zero.

In an effort to resolve this issue, I've simplified my rule to use the use cases from our most current sprint.  I then created a variable for the total number of sub-tasks

totalSubtasks {{issue.subtasks.size}}

 

Next, I tried to determine the number of "done" subtasks several ways.  I have a variable for each:

doneSubtasks {{issue.subtasks.where(statusCategory.key = "done").size}}

 TOTALDONE {{issue.subtasks.where(status.name = "DONE").size}}

Each time these come back equaling zero,

 

My original attempt was a little more complicated.  A screenshot of the rule is below.  Again, each time the number of sub-tasks with a status of "done" is zero.

Rule.png

 

Any help is greatly appreciated.

2 answers

1 vote
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.
August 14, 2025

Hi @Greg Aurand -- Welcome to the Atlassian Community!

There is no where() function for smart values, and there is no key attribute for the statusCategory. 

Which source suggested those to you for rules as it is incorrect?

 

Next, your rule does not need the Rule Group structure, and I recommend not using that new feature unless absolutely necessary.

 

Assuming you want to count percentage complete by counts, and your work item has subtasks, this expression would work, with extra spacing added to help explain it:

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

How that works is, explaining from the inside toward the outside:

  • iterate over the subtasks
  • using a conditional expression to perform smart value, list filtering to 
  • to only return items where the status' category is "Done"
  • and then adding +1 to the count
  • wrapping that summation in a math expression, with a 0 default at the front
  • dividing that by the total count of subtasks, which is the list size, with a default of 0
  • multiplying this fraction by 100 to convert into a percentage
  • rounding to a whole number
  • finally, wrapping all of that in another math expression

 

Kind regards,
Bill

0 votes
Mikael Sandberg
Community Champion
August 14, 2025

Hi @Greg Aurand,

Welcome to Atlassian Community!

You cannot use JQL as part of your smart value, that is why they return as empty. What you could do is a lookup work items for done sub tasks linked to the current work item and then use {{lookupIssues.size}} to get the number of done sub-tasks. 

Suggest an answer

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

Atlassian Community Events