Hi Team,
I have a requirement "Add Sub-Task Count (Numeric) field to be auto-updated based on related sub-tasks (child) with a Status != Closed. "
I have tried with below code as per our old community tickets. Its working , but i would like to get only open tickets count, not all tickets count. Any suggestion how to add the jql in this script?
if (issue.getIssueType().name != "Sub-task") { // only calculate this for non-subtask issues
def subTaskSum = 0
issue.getSubTaskObjects()?.each { subtask -> // go through all subTask issues
subTaskSum += 1
}
return subTaskSum
You'll need to wrap the subTaskSum += 1 in an "if subtask.getResolution()" statement, so that it only counts for unresolved issues.
Thank you @Nic Brough -Adaptavist- and Atlassian Community members. You are always very fast in responses and helping to Atlassian administrators. Thanks much.
This is code is working as espected.
def subTaskSum = 0
issue.getSubTaskObjects()?.each {
subtask -> subtask.getResolution()==null?subTaskSum += 1:subTaskSum
}
return subTaskSum
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would like to have a field which shows the substasks bar progress as a percentage number.
I am also wondering to have custom fields which counts the number of each substasks category status (issue atribute).
- Pending
- In progress
- Concluded
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.
In a scriptrunner script. The code given will work for a scripted field, post-function or listener, with a couple of other lines appropriate to where it is being run.
You could use something similar to look at all the sub-tasks of an issue and extract field data from them - the code Lakshmi gave us is iterating over the sub-tasks and adding 1 to a variable for each resolution found, but you could read any field and perform any logic you wanted to in there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.