I am trying to see the last value for a specific custom field with the code below but I m getting an error. Could someone advise how to resolve this?
import com.atlassian.jira.issue.changehistory.ChangeHistoryManager;
import com.atlassian.jira.issue.history.ChangeItemBean;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
//For test
Issue issue = ComponentAccessor.getIssueManager().getIssueByKeyIgnoreCase("EPIC-10");
String fieldName = 'Who'
def ChangeHistoryManager= ComponentAccessor.getChangeHistoryManager();
List<ChangeItemBean> changeItems
changeItems = ChangeHistoryManager.getChangeItemsForField(issue, fieldName)
if (changeItems.size()>0) {
return changeItems.get(0).getFrom()
}