Skip to main content
Example scripts
arrow icon
To homepage
Jira
Cloud icon
Cloud

Count Stories Per Project

Created 1 year ago, Updated 1 day(s) ago
App in script
ScriptRunner For Jira
ScriptRunner For Jira
by Adaptavist
Compatibility
compatibility bullet
Jira
Language |
groovy
import groovy.xml.MarkupBuilder

def mapping = Issues.search("issuetype = Story").countBy { issue ->
    ((Map<String, Map>) issue.fields).project.key
}

def writer = new StringWriter()
def builder = new MarkupBuilder(writer)
builder.table(class: "aui") {
    thead {
        tr {
            th("Project Key")
            th("Count")
        }
    }
    tbody {
        mapping.each { projectKey, count ->
            tr {
                td {
                    b(projectKey)
                }
                td(count)
            }
        }
    }
}

writer.toString()
Having an issue with this script?
Report it here