Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Returns the number of issues that are unresolved in the current project

Configuration

1. Create a Projectrak Script field called "Total unresolved issues".

2. Insert the following Groovy script and modify accordingly to your instance:

Groovy Script

...

total-unresolved-issues.groovy
linenumbers
Code Block
languagetruegroovy
package deiser.profields.scripts

import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.jql.builder.JqlQueryBuilder
import com.atlassian.jira.web.bean.PagerFilter


// Components
def searchService = ComponentAccessor.getOSGiComponentInstanceOfType(SearchService.class)
def jiraAuthenticationContext = ComponentAccessor.jiraAuthenticationContext

// Script variables
def loggedInUser = jiraAuthenticationContext.getLoggedInUser()

// Make JQL query
def query = JqlQueryBuilder.newBuilder()
        .where()
        .project(project.id).and()
        .unresolved()
        .buildQuery()

// Returns the issue count
return searchService.search(loggedInUser, query, PagerFilter.unlimitedFilter).results.size()

3. Configure the project's layout including "Total unresolved issues"

4. Associate the Layout to the Software project you need this information to be applied to.

...