Dear Atlassian community,
I've build a counter with scriptrunner, with the following code:
import com.atlassian.jira.component.ComponentAccessor
ComponentAccessor.getIssueLinkManager().getLinkCollection(issue, issue.reporter)
.getAllIssues().count {
it.getIssueType().getName() == "Incident"
}
.toString()
What this counter is doing it count all related issues with IssueType "Incident".
But how can I extend this that my counter only count the issues with issuetype "incident" that are unresolved? So with resolution = unresolved?
Thank you in advance if somebody can help
Best Regards,
Hello @wvorigin
Like this :
import com.atlassian.jira.component.ComponentAccessor
ComponentAccessor.getIssueLinkManager().getLinkCollection(issue, issue.reporter)
.getAllIssues().count {
it.getIssueType().getName() == "Incident" && issue.resolution == null
}
.toString()
Hello @Mark Markov,
Thank you for your reply.
The code is accepted, only it still count related issues that have a resolution as well.
So there is no different situation as my original counter.
Any other idea?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My bad, ive made mistake in condition, tryed to equals issue resolution instead of link issue :)
Here is right version
import com.atlassian.jira.component.ComponentAccessor
ComponentAccessor.getIssueLinkManager().getLinkCollection(issue, issue.reporter)
.getAllIssues().count {
it.getIssueType().getName() == "Incident" && it.resolution == null
}
.toString()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You re welcome! If it helps you please mark answer as accepted :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I made a number type custom field named PlanPercent. I I would like to update the percentage value by counting the issues whose status of the linked issue type is Hierarchy link (WBSGantt) and whose status is Completed. If issue A has 5 Hierarchy link (WBSGantt) linked issues, and 3 linked issues are Completed, percentage value must be 60. It is calculated by 3/5* 100.
Can you give me groovy script?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One question here
I am looking similar thing to have counter so any time issue gets related to other tickets counter field show number of tickets related on the ticket itself.
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.