Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,293,451
Community Members
 
Community Events
165
Community Groups

How to get all issues of a certain project and then group those issues by Organizations

I'm trying to get all issues of our service desk project and group the result by Organizations. I'm trying to do it by running the below script on ScriptRunner console.

Map<String, Object> searchResult = get('/rest/api/2/search')
.queryString('jql', 'project = "ITZone Software Support"')
.queryString('fields', '*all,-comment')
.queryString('maxResults', '1000')
.asObject(Map)
.body

def issues = (List<Map<String, Object>>) searchResult.issues

issues.groupBy { issue ->
((Map<String, Map>) issue.fields).Organizations
}.collectEntries { Organizations, issueList ->
[(Organizations): issueList.size()]
}.toString()

 

The result I'm getting is:

[null:100]

What went wrong in my script?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

181 views 0 4
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you