Forums

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

Show previous priority in mail (Velocity template)

bschmi
Contributor
June 17, 2018

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

1 answer

1 accepted

0 votes
Answer accepted
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 18, 2018

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())
bschmi
Contributor
June 19, 2018

Perfect! Many thanks from our side!

Cheers,

Birgit

Suggest an answer

Log in or Sign up to answer