Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,293,796
Community Members
 
Community Events
165
Community Groups

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
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

223 views 0 6
Join discussion

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