I have set up an automated rule in our Jira instance so that the custom field 'Percentage completed' on an Epic will update based on the status of the Epic's child work items. So, when a Story, Task, Sub-task, Bug, Bug Sub-Task, or UAT Bug that is parented to an Epic has the Status updated to Removed, Done, Resolved, Rejected, or Closed, the 'Percentage completed' field will automatically update on the Epic.
However, I have manually updated a Story that is parented to an Epic to 'Done' to check if the rule works, and the percentage has not updated. I have checked the audit log of the rule and it appears to have run, stating the epic has been updated, but the 'Percentage completed' field still stats 0%.
To troubleshoot, I have checked the type of the custom field is correct (set to Number Field), and updated the Actor of the rule to myself, as I wondered if it was a permissions issue with the Automation for Jira actor.
The rule is:
Trigger: When work item transitioned to Removed, Done, Resolved, Rejected, Closed
Issue type is one of Story, Task, Sub-task, Bug, Bug Sub-Task, UAT Bug
Branch: For Parent
Then: Lookup work items:
parent = {{issue.key}}
And: Lookup work items:
parent = {{issue.key}} AND status in (Resolved, Done, Removed, Closed, Rejected)
And: Create variable:
Variable name = totalChildren
{{lookupIssues.size|0}}
And: Create variable:
Variable name = closedChildren
{{lookupIssues_1.size|0}}
If: Compare two values
First value = {{totalChildren}}
Condition = greater than
Second value = 0
Then: Create variable
Variable name = percentComplete
{{#=}}{{closedChildren}} / {{totalChildren}} * 100{{/}}
And: Edit work item fields
Field = Percentage completed
{{percentComplete}}
Can anyone provide some suggestions or pointers as to why this isn't updating the field? Eventually I would like to create the same rule to update the Features and Initiatives we have set up
Any help much appreciated
Thanks