Hi community,
meanwhile I make extensive use of velocity templates and it works well.
Is there an easy way to Display the "previous" priority of an issue while sending a mail via a groovy script & velocity template.
For example, if there is priority "info", "severe", "blocker" and an issue is on "blocker" and was on "severe" before within the mail it should read "severe".
At the Moment only the current priority is accessible via the offered variabled in velocity templates.
Cheers,
Birgit
Hello @bschmi
I'm not sure about easy way of getting previous priority, but you can get it via ChangeHistotyManager. Look at example for Script Console
import com.atlassian.jira.component.ComponentAccessor
def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("AP-1")
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def changeHistory = changeHistoryManager.getChangeItemsForField(issue, "priority")
log.error("Change History: "+ changeHistory.last().getFromString())
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.