Date of issue closing - scripted field

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

0 vote

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.

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 vote

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

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira Service Desk

Wy are we still using email for Service Desk workflows?

...attest to the experience of an urgent approval that gets lost in the boss’s inbox and requires that special “Please Approve” email or text message. In an age where we have distributed teams...

111 views 0 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you