You can use te changeHistoryManager like so:
def changeItems = ComponentAccessor.getChangeHistoryManager().getAllChangeItems(issue)
This will contain an arrayList of all the changes that the issue has gone through, including status changes.
My searching capabilities led me to this link, which contains an answer from another Community Champion that confirms it.
Do say if you need anymore help.
Ah yes, "documentation" they call it.
As you can see in that documentation, it has a varios set of maps, one that is named FROM and another on that's named TOS. This would seem like the most logical place for the information that you are looking for.
I actually don't have a clue as to what those maps contain, but when I'm dealt bad documentation from our blue friends I usually get an instance of the object in the Script Console of SR and do something like this.
1. Get an issue with the IssueManager.
2. Get your history changes in one object, in this case, let's call it changeItems like before.
3.Then output something like this.
That way, you have a clear text output of what the object contains.
That should give you some more insight. If you are not self sufficient, I could find out for you if you want.
Do tell me if I can help you further.
For anyone's reference, getFroms() will get the state name (value) and ID (key) in some of the ChangeHistoryItems.
It's easier if you use getChangeItemsForField(Issue, Field) though and then just pull it's 'from' variable. If you're looking for something to get the last status, here it is:
//Gets List of all changes to 'status' and takes from last one in the list
def changeItem = ComponentAccessor.getChangeHistoryManager().getChangeItemsForField(issue, 'status')?.last()
//variable 'from' is the previous state, 'String' for String type
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!
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