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

Days In Status

Jon Kocen March 31, 2020

Been wrestling with how to know how many days an item has been in the current status. Well with the help of our community, I put together some ScriptRunner fields that seems to be doing the job for me.

Fist I created a Time of Last Status Change fields using Script Runner's Field feature. This is a provided feature. I called this field Status Change Date.

Then I created another field using the Custom Script Field. I took today's date minus the Last Status Change field (created above) and output it as a number.

Code in the Days Since Created field using the Custom Script field

import com.atlassian.jira.component.ComponentAccessor
import java.sql.Timestamp
import java.time.DayOfWeek
import java.text.SimpleDateFormat


import com.atlassian.core.util.DateUtils
import com.atlassian.jira.datetime.LocalDate

def enddate = new Date() as Date
def startdate = issue.getCreated()

Integer daydelta = enddate - startdate

return daydelta

 

This community has been a great help to me and I hope this helps others

 

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events