Skip to main content
Book your demo
Example scripts
To homepage
Jira
Cloud icon
Cloud

Count Stories Per Space

Created 2 year(s) ago, Updated 23 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 = WorkItems.search("issuetype = Story").countBy { workItem ->
    ((Map<String, Map>) workItem.fields).project.key
}

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

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