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

0 vote
Vasiliy Zverev Community Champion Jan 13, 2016

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

47 views 0 4
Read article

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