Is it possible to get transition dates using script runner?

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

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 ?


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.


trans date.jpg

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 ?

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

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.

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

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"

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

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.

Do i need to log that as another question?

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

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).

I hope that makes sense?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 15, 2019 in Jira Service Desk

Are you a Jira Service Desk agent? We want to talk to you!

Are you a whiz at handling tickets and looking at how you can further optimize your workflow with automation? Do you tackle detailed customer support questions while simultaneously getting flooded wi...

176 views 0 8
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you