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
Community moderators have prevented the ability to post new answers.
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 ....
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<ChangeItemBean> assigneeChHistory = changeHistoryManager.getChangeItemsForField(mutableIssue, "assignee"); if (!assigneeChHistory.isEmpty()) { ChangeItemBean assigneeChItemBean = assigneeChHistory.get(assigneeChHistory.size() - 1); assigneeChItemBean.getFrom()); previousAssignee = assigneeChItemBean.getFrom(); }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
is there any way to get previous assignee from history of issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can look up the ChangeHistory and work it out that way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.