Forums

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

How to write script for retrieving date for particular status changing one status to another status

Venugopala Naidu
Contributor
February 6, 2019

My project has two issue types i.e story and defect . For story issue type i have one workflow . In that workflow  one issue is transition from one status to another status how to get date and time of each status using script runner plug in 

1 answer

0 votes
Sreenivasaraju P
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.
February 6, 2019

Hi @Venugopala Naidu,

 

Try below script , it should work

 

import com.atlassian.jira.component.ComponentAccessor

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

def createdTime = created?.getTime()

createdTime ? new Date(createdTime) : null

 

For more details, you can refer

https://library.adaptavist.com/entity/store-the-time-when-an-issue-was-first-transitioned

Venugopala Naidu
Contributor
February 7, 2019

Hi @Sreenivasaraju P

Ok,  thanks raju gari

But i want to generate a report of each status with date and time 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events