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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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.

Example...

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"
}?.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

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?

@Thanos Batagiannis _Adaptavist_ 

How do i get date of the last transition status.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

241 views 1 6
Read article

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