very easy, the trick is access to the class changeHistoryManager.
Try this example in the “Adaptavist Scriptrunner” Script Console view. Just put the ID of the ticket and run the code. You will see always the last change of the issue.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.IssueManager IssueManager issueManager = ComponentAccessor.getIssueManager(); def issue = issueManager.getIssueObject("JIRA-1234"); def changeHistoryManager = ComponentAccessor.getChangeHistoryManager() def changeItems = changeHistoryManager.getAllChangeItems(issue) if (changeItems?.size() > 0) { def userUtil = ComponentAccessor.getUserUtil() def last_change = changeItems.sort(false).last() def text = "LAST MODIFIED FIELD:"+ last_change["field"]+ "; FROM VALUE:"+ last_change["fromValue"] + "; TO VALUE:"+ last_change["toValue"] return text; } else { return "NO CHANGES" }
In Jira 9 the line 12 of the code must be like this:
NOTE the last “s” in fromValues and toValues
LikeLike