I am trying to count Resolved Subtasks:
import com.atlassian.jira.issue.Issue Collection<Issue> subTasks = issue.getSubTaskObjects(); int count = 0; for (Issue i : subTasks) { if (i.getStatus().toString()=="Resolved") count++ return count.toString() }
But it return 0. Where is the problem?
Community moderators have prevented the ability to post new answers.
issue.subTaskObjects.count { it.statusObject.name == "Resolved" }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where are you trying to use this code? In a scripted field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your code returns on first iteration of the loop. I guess you need to move return out of the loop:
for (Issue i : subTasks) { if (i.getStatus().toString()=="Resolved") count++ } return count.toString()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, but there is still the same problem. It returns 0. I do not know, whether condition if (i.getStatus().toString()=="Resolved") is correct.
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.