Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

History of issuetype - Get issue previous type

Dan27
Contributor
May 21, 2019

Hello,

Is it possible to get the previous type of an issue using groovy?

I need to know it for a condition inside my script listener.

 

Thanks,

Daniel

2 answers

1 accepted

1 vote
Answer accepted
Dan27
Contributor
May 22, 2019

I found a solution:


ChangeHistoryManager changeHistoryManager =ComponentAccessor.getChangeHistoryManager();

 

List <ChangeItemBean> changeItemBeans= changeHistoryManager.getChangeItemsForField(issue, "issuetype");
def sizeHistory = changeItemBeans.size()
return changeItemBeans[sizeHistory-1].fromString

0 votes
Max Foerster - K15t
Community Champion
May 22, 2019

Hi Daniel,

I can't give you a very specific answer on how to do it but as long as you're able to access the issue's history entries you should be able to retrieve that issue type information from the entry of the move operation.

Best, Max

Dan27
Contributor
May 22, 2019

Thanks Max,

I found a solution:


ChangeHistoryManager changeHistoryManager =ComponentAccessor.getChangeHistoryManager();

 

List <ChangeItemBean> changeItemBeans= changeHistoryManager.getChangeItemsForField(issue, "issuetype");
def sizeHistory = changeItemBeans.size()
return changeItemBeans[sizeHistory-1].fromString

 

BR,

Daniel

Suggest an answer

Log in or Sign up to answer