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

Ed Schriger January 13, 2016

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 votes
Joe Pitt
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 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.

0 votes
Vasiliy Zverev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 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}
    }

 

Suggest an answer

Log in or Sign up to answer