Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how to get previous assignee of the issue.

Ramesh Udari1 August 29, 2012

Hi,

In our workflow we have different assignee for each transition, but we have ecounter one situation that where we want to get previous assignee of the issuee on perticualar trastision.here my question is that how to get previous assigne in post function by using jira api. we are using JIRA 4.3.3

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Radu Dumitriu
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.
August 29, 2012

Working example:

ChangeHistoryManager chm = ComponentManager.getComponentInstanceOfType(ChangeHistoryManager.class);

List<ChangeItemBean> hst = chm.getChangeItemsForField(issue, fieldName);

//sort it by date

Collections.sort(hst, new Comparator<ChangeItemBean>() {
public int compare(ChangeItemBean o1, ChangeItemBean o2) {
return o1.getCreated().compareTo(o2.getCreated());
}
});

//now you can look into it and get what you want ....

Ramesh Udari1 August 30, 2012

Hi Radu,

Thanks for your repaly on this.

I have laready implemented in simmilar way...below is the code snippet.

ChangeHistoryManager changeHistoryManager = ComponentManager.getInstance().getChangeHistoryManager();
                    List&lt;ChangeItemBean&gt; assigneeChHistory = changeHistoryManager.getChangeItemsForField(mutableIssue, "assignee");
                                  
 if (!assigneeChHistory.isEmpty()) {
                        ChangeItemBean assigneeChItemBean = assigneeChHistory.get(assigneeChHistory.size() - 1);
                        assigneeChItemBean.getFrom());
                       previousAssignee = assigneeChItemBean.getFrom();
  }

Like Artem Grotskyi likes this
Radu Dumitriu
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.
August 30, 2012

The only problem with this code is that no-one guarantees that your item is the last one. It is better to sort it accordingly.

Edit: For your case, it is even better to search for the date just below las change of the assignee. Complexity is O(n), which should be better then O(n * log(n))

Rumceisz November 8, 2012

Hi Radu,

is it a scripted field?

I also need the list of the previous + current assignees of each issue (reporting need of meny project leaders). They also need the time spent of each assignees: you know they calculate the fees of the developers based on this report.

Can you please advise?

Thanks in advance!

Rumi

0 votes
Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 13, 2014

Hi,

JIRA Enhancer Plugin has these custom fields. And also it has "Time Between" custom field in which you define origin and target statuses and it shows the time passed between the statuses.

Regards

Tuncay

0 votes
Harry Chan
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.
August 29, 2012

Hi, the way we do this is to create a user picker customfield that is not shown anywhere. On every transition we set that field to the value of the current assignee. Unless anyone has a better idea, that's how we get the previous assignee.

Ramesh Udari1 August 29, 2012

is there any way to get previous assignee from history of issue?

Harry Chan
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.
August 29, 2012

You can look up the ChangeHistory and work it out that way.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events