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

Is it possible to get transition dates using script runner?

Rob B
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.
November 21, 2017

I need to get the date of certain transitions in certain issues. We are currently manually going into each issue to get the dates.

1 answer

0 votes
Thanos Batagiannis _Adaptavist_
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.
November 21, 2017

Hey Robert 

When you say certain issues I suppose issues that you can get from a JQL ?

Also you say the date of certain transitions does this means the first time that the issues got into that transition ?

 

Rob B
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.
November 21, 2017

Hi Thanos,

Yes we run some JQL to export our SLA data, but we manually add a column for transition dates and we get these by manually going into each call. This is basically so we know when the SLA starts.

Example...

trans date.jpg

Thanos Batagiannis _Adaptavist_
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.
November 21, 2017

Hey Robert, 

So what about using a scripted field that will show you the date of first transition, and then since you will have this value in a field you will be able to export it in the same way as any other field. 

How does this sound ?

Rob B
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.
November 21, 2017

Where do i declare what issuetype we are reporting?

(eg. issuetype=BILL01 and status=Review)

Sorry about this but im a beginner to this. Thanks

Thanos Batagiannis _Adaptavist_
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.
November 21, 2017

Which version of ScriptRunner you use ? 

If you are in one of the latest versions there is already a canned scripted field Date of First Transition.

Rob B
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.
November 21, 2017

Unfortunately we are only using version 4.3.19, but we are doing an upgrade next year. Finally!

Thanos Batagiannis _Adaptavist_
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.
November 21, 2017

Hey Robert, 

No worries. So you have to create the scripted field manually. It is easy. So go to the scripted fields section and add a new one. 

The script for this should be

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

And the configuration should be 

Searcher: Date Time Range picker
Template: Date Time Picker

In the end your scripted field should look like

Screen Shot 2017-11-21 at 15.02.20.pngAnd then you can start using it as any other custom field. 

Please let me know how this went.

Regards, Thanos

Like # people like this
Rob B
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.
November 22, 2017

The field created with the correct data! Cheers Thanos!

Would i need to create a new one for every transition an SLA starts on? For example we have 3 SLAs on one workflows which all start on different statutes.

Rob B
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.
November 23, 2017

Do i need to log that as another question?

Thanos Batagiannis _Adaptavist_
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.
November 23, 2017

Hey Robert, 

No it's all right, I just missed the reply. Can you please give me an example or use case for your second question ?

Regards, Thanos

Rob B
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.
November 23, 2017

The users are running a report about SLAs which captures the usual, but they want the start date of the SLA (hence creating the script field), but some issues have more than one SLA, so does this mean have a different script field for each status (start of SLA).

Rob B
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.
November 27, 2017

I hope that makes sense?

shiva November 19, 2020

@Thanos Batagiannis _Adaptavist_ 

How do i get date of the last transition status.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events