How do I get a report of the name of the user who resolved an issue for issues closed last N days?

We are using JIRA On Demand and would like to create a filter that identifies the user who marked an issue as RESOLVED along with the date of resolution.

In other words:  For issues CLOSED last N days, show me the issue type, issue number, summary, name of the user who marked the issue resolved, the resolution date, the closed date.

On a single issue we can determine the "resolver" by looking in the History log.

But we would like to figure out how to write a Search Filter to run this as a report or create a dashboard element from it.

2 answers

I can propose 2 ways to do it

  1. Use SQL like:

    Select
    	issuetype.pname
    	, project.pkey + '-' + CAST( jiraissue.issuenum as varchar(20))
    	, jiraissue.SUMMARY	
    	, cwd_user.display_name	
    	, changegroup.CREATED	
    from
    	changegroup
    	join changeitem on	changegroup.ID = changeitem.groupid
    	join cwd_user	on	changegroup.AUTHOR = cwd_user.user_name
    	join jiraissue	
    		join issuetype	on	jiraissue.issuetype = issuetype.ID
    		join project	on	jiraissue.PROJECT = project.ID
    	on	changegroup.issueid	= jiraissue.ID
    where
    	changeitem.FIELD = 'resolution'
    	and changeitem.OLDVALUE is null
    order by
    	changegroup.CREATED desc

    But you can not use it for dashboards

  2. Create scripted field via ScriptRunner to get user who resolved an issue. Here is a code example to look for change history (some russian comments):

    import com.atlassian.jira.component.ComponentAccessor
    import com.atlassian.jira.issue.Issue
    import com.atlassian.jira.issue.changehistory.ChangeHistory
    import com.atlassian.jira.issue.changehistory.ChangeHistoryManager
    import com.atlassian.jira.issue.history.ChangeItemBean
    
    /**
     * Created by VZverev on 01.12.2015.
     */
    
    Issue issue;
    
    ///Начальное значение для статуса
    PreviousStatus prevStatus = new PreviousStatus(Calendar.getInstance().getTimeInMillis(), issue.getStatusObject().getName());
    ChangeHistoryManager changeHistoryManager = ComponentAccessor.getChangeHistoryManager();
    
    //Дата, с которой анализируем историю изменений
    Calendar lastFriday = Calendar.getInstance();
    lastFriday.add(Calendar.WEEK_OF_YEAR, -1);
    lastFriday.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
    lastFriday.set(Calendar.HOUR,11);
    Date lastFridayDate = new Date(lastFriday.getTimeInMillis())
    
    if(issue.getCreated().getTime() > lastFriday.getTimeInMillis())
        return "новый запрос";
    
    for(ChangeHistory changeHistory: changeHistoryManager.getChangeHistoriesSince(issue, lastFridayDate)) {
        for(ChangeItemBean changeItemBean: changeHistory.getChangeItemBeans())
            if(changeItemBean.getField().equals("status")) {
                prevStatus.setNewStatus(changeItemBean.getCreated().getTime(), changeItemBean.getFromString());
                break;
            }
    }
    
    return prevStatus.getStatus().equals(issue.getStatusObject().getName())?"не изменился": prevStatus.getStatus()
    
    class PreviousStatus{
        private long dateInMills;
        private String value;
    
        public PreviousStatus(long _dateInMills, String _value){
            dateInMills = _dateInMills;
            value = _value;
        }
    
        public setNewStatus(long _dateInMills, String _value){
            if(_dateInMills < dateInMills){
                dateInMills = _dateInMills;
                value = _value;
            }
        }
    
        public String getStatus(){return value}
    }

 

0 vote
Joe Pitt Community Champion Jan 14, 2016

Since you're using the on demand version, you can't use scripting and and the SQL can't be used in a filter. A method I've used in the past for capturing milestone info is to copy the info to new step specific fields. You'd create a custom 'closed date' and 'closed by' fields. In a the post functions copy the updated date and user to those fields. Make sure you put the copy updated date AFTER the update function in the post function list. I always restrict transitions to the assignee so I copy the current assignee field. Put them on the view screen and they will be readily visible. Also remember to clear them if you reopen the issue or having an open issue with closed date and user will be confusing to most people. As I mentioned I like this for all milestone events like passed testing, reopened, etc.

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...

767 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