Forums

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

Script field show the date of transit tostatus B from status B

Harry Huang October 16, 2019

 

I have three status,"SIT Testing", "SIT Done" and "ReToDo"

 

And I want a field to show the date of  transit to "SIT Done" or "ReToDo" from "SIT Testing".

 

How to do it?

 

Does it can be true?

 

1 answer

1 accepted

0 votes
Answer accepted
Harry Huang October 16, 2019
package com.onresolve.jira.groovy.test.scriptfields.scripts

import com.atlassian.jira.component.ComponentAccessor


def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def created = changeHistoryManager.getChangeItemsForField(issue, "status").reverse().find {
if(it.fromString=="SIT Testing")
it.toString == "SIT Done" || it.toString == "ReToDo"
}?.getCreated()

def createdTime = created?.getTime()

createdTime ? new Date(createdTime).format("yyyy/MM/dd") : null

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events