Display/Export all task assignee from Query

I would like to be able to export all the assignees for a list of tasks base on a query.

Is there a way to do this?

Many thanks

2 answers

1 vote
Henning Tietgens Community Champion Jun 16, 2014

Simply search for the issues and export the resulting list to excel. The assignee should be included in the list.

It only displays the current assignee.

Henning Tietgens Community Champion Jun 16, 2014

Ah, ok, you need all assignees from the history of the issues. I don't think that this is possible out of the box.

Yep thatis about right. Is there a plug in or something that could give it to me? I cannot be the first person to wwant this.

1 vote
Henning Tietgens Community Champion Jun 16, 2014

You could use the Script Runner plugin and execute this code in the console to get the names of all assignees of the specified JQL search (jqlQuery).

import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.ApplicationUsers
import com.atlassian.jira.web.bean.PagerFilter

def jqlQuery = "project = JSU"

List<ApplicationUser> assignees = []
def userUtil = ComponentAccessor.userUtil

def issues = getFilterResult(jqlQuery)
issues.each { issue ->
    def changeItems = ComponentAccessor.changeHistoryManager.getAllChangeItems(issue)
    if (changeItems?.size() > 0) {
        changeItems.findAll { it.field == 'assignee' }.each { it ->
            assignees << userUtil.getUserByKey(it.fromValue)
            assignees << userUtil.getUserByKey(it.toValue)
        }
    } else {
        assignees << userUtil.getUserByKey(issue.assigneeId)
    }
}
assignees.unique().sort().displayName.join("\r\n")

List<Issue> getFilterResult(String jqlSearch) {
    SearchService searchService = ComponentAccessor.getComponent(SearchService.class);

    ApplicationUser user = ComponentAccessor.jiraAuthenticationContext.getUser()

    SearchService.ParseResult parseResult = searchService.parseQuery(ApplicationUsers.toDirectoryUser(user), jqlSearch)
    def searchResult
    if (parseResult.isValid()) {
        searchResult = searchService.search(ApplicationUsers.toDirectoryUser(user), parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
    } else {
        log.error("Invalid JQL: " + jqlSearch);
    }
    return searchResult?.issues
}

Thanks for that I will see if I can get our admin to install script runner.

Many thanks

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

783 views 2 19
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you