Description
It returns a list of Issues based on a JQL filter.
Configuration
1. Create a Projectrak Script field called "Project mentioned in"
2. Insert the following Groovy script and modify accordingly to your instance:
Info |
---|
How to get the result as a list with links: after execute the JQL in the line 26 we return an HTML label for each issue with the key, summary, and status. |
Groovy Script
...
...
project-mentions.groovy
Code Block | ||
---|---|---|
| ||
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 import com.atlassian.query.operator.Operator import com.atlassian.jira.config.properties.APKeys // Components def searchService = ComponentAccessor.getOSGiComponentInstanceOfType(SearchService.class) def jiraAuthenticationContext = ComponentAccessor.jiraAuthenticationContext // Script variables def loggedInUser = jiraAuthenticationContext.getLoggedInUser() def baseUrl = ComponentAccessor.getApplicationProperties().getDefaultBackedString(APKeys.JIRA_BASEURL) // Make JQL query def query = JqlQueryBuilder.newBuilder() .where() .addStringCondition("Related to project", Operator.EQUALS, project.key).and() .resolution("unresolved") .buildQuery() // Returns the issue list searchService.search(loggedInUser, query, PagerFilter.unlimitedFilter).results .collect{ issue -> "<a href='${baseUrl}/browse/${issue.key}</a> - ${issue.summary} - ${issue.status.name}" }.join("<br/>") |
3. Configure the project's layout including "Project mentioned in" field
4. Associate the layout to the projects you need this information to be applied to.
5. The result should be something like this: (please, keep in mind that this is only an example and your results should vary from what it is shown in the screenshot).
...