Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Get Last Transition Date using Script Runner

Hi,

I would like to change get the last transition date, how do I change this script runner script to do this?

Many Thanks

Kevin

 

package com.onresolve.jira.groovy.test.scriptfields.scripts

import com.atlassian.jira.component.ComponentAccessor

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def created = changeHistoryManager.getChangeItemsForField(issue, "status").find {
    it.toString == "Done"
}?.getCreated()

def createdTime = created?.getTime()

createdTime ? new Date(createdTime) : null

1 answer

I'd like to figure this one out to. The problem is this:

I can make a scripted field to capture the date the transition was executed, and I'm all set for new issues.

However, my user just asked to get this populated on existing issues, which means poking through history.

I assume I need to build an array here and look for the last instance, but perhaps there is some more elegant way to do this.

Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

142 views 1 12
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you