Forums

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

Over due days

Rajesh Ramankutty
Contributor
May 8, 2019

Hi Guys,

 

we have due days in the custom which shows each issue due day and i want to create overdue custom field that will show how many days it is completed after the due date can anyone tell me what to do that?

1 answer

0 votes
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 9, 2019

Hello Rajesh,

Unfortunately, it's not possible to calculate the days between two date fields in JIRA, however, there are some plugins which provide you with this functionality.

Can you please let us know if you are using JIRA Cloud or Server so we can search for some options that you can use?

For now, check if the Scripted fields provided by Scriptrunner plugin works for you. 

The snippet that should get you close to the solution, as you need to first get the custom field object and then use this object to get the value from the issue's date custom field

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import  java.util.Date.*

def customFieldManager = ComponentAccessor.getCustomFieldManager();
def dateFieldObject= customFieldManager.getCustomFieldObject('customfield_11601');

def dateFieldObject2= customFieldManager.getCustomFieldObject('customfield_11602');

if(issue.getCustomFieldValue(dateFieldObject) && issue.getCustomFieldValue(dateFieldObject2)) {
def dateValue=  issue.getCustomFieldValue(dateFieldObject) as Date
def dateValue2=  issue.getCustomFieldValue(dateFieldObject2) as Date
return dateValue - dateValue2
}

More here for groovy  - https://stackoverflow.com/questions/2755835/duration-between-two-dates-in-groovy 

Let me know if this information helps.

Rajesh Ramankutty
Contributor
May 11, 2019

Hello @Petter Gonçalves  Thank you .

We are using jira core server version 7.13.0

will try what you have said and come back to you.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events