The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Date of issue closing - scripted field

Rumceisz
Contributor
October 30, 2012

Hi All,

I need to capture the clsoing date (or last closing date) for each issue in the past too!

Can you please help me to how can we do that in scripted field? I mean: have you got a code?

I did it with post function but it fills the custom field with the closing occured now and he future.

Thanks in advance!

Rumi

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
JamieA
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 Champions.
October 30, 2012

changeHistoryManager.getChangeItemsForField(issue, "status").reverse().find{it.toString == "Closed"}?.getCreated()

0 votes
Rumceisz
Contributor
October 30, 2012

Hi Jamie,

I find a script but it results the first closing date.

In case of the issue was reopened and then closed again - it's not good. I need the date of the last closing transition.

I am not very pro in scripting, can you please help how to modify the code?

import com.atlassian.jira.ComponentManager
 
def componentManager = ComponentManager.getInstance()
def changeHistoryManager = componentManager.getChangeHistoryManager()
changeHistoryManager.getChangeItemsForField(issue, "status").find {it.toString == "Closed"}?.getCreated()

Thanks in advance,

Rumi

0 votes
JamieA
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 Champions.
October 30, 2012

You just need to whip through the changelog and get the date for the last transition where it entered the Closed state. There are quite a few examples about that are very close to that.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events