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?
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.