Hello,
How to display a difference between issue created date and issue resolved date using JQL. Need to display the data per issue in Confluence using Jira macro
Thank you!
Hi @Igor Ivanenko
You cannot as JQL return a list of issue but what you can do us to use a JIRA Issue Macro, input your JQL then display the created date and resolved date.
If you need the number of days you will have to use a calculated field in JIRA from an app. You should be able to do it with Scriptrunner.
Regards
Hi Florian, thanks again. I’ve already done this but my team is looking for a column that shows the time (days) spent on a task. I tried to find it among “Columns to display”
You may try to create an automation for JIRA that compute the number of days between both date and store this value in a field or even log this time against that issue and display the Time Spent.
Automation for JIRA is free if you are in Data Center.
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/
Doc is for Cloud but those function should work on Server as well.
I agree with @Florian Bonniec
You can achieve the same with ScriptRunner for Jira as well.
I have a similar script to calculate the age of a ticket which might help you get started.
import com.atlassian.core.util.DateUtils
def createTime = issue?.getCreated()?.getTime()
def currentTime = (new Date()).getTime()
def resolvedTime = issue?.getResolutionDate()?.getTime()
/*
https://docs.atlassian.com/jira/server/com/atlassian/jira/issue/status/category/StatusCategory.html
https://docs.atlassian.com/jira/server/constant-values.html#com.atlassian.jira.issue.status.category.StatusCategory.COMPLETE
COMPLETE == 'done'
IN_PROGRESS == 'indeterminate'
TO_DO == 'new'
UNDEFINED == 'undefined'
*/
def issueCategory = issue?.getStatus().getStatusCategory().getKey()
// if ticket category is undefined/no category
if (issueCategory == 'undefined') {
return 0
}
// if ticket category is TO_DO/new or IN_PROGRESS/indeterminate
// OR if resolvedTime is null, calculate age using ticket created time
def ageInDays = issueCategory in ['new', 'indeterminate'] || resolvedTime == null
? (currentTime - createTime) / 86400000 // milliseconds in a day
: (resolvedTime - createTime) / 86400000 // milliseconds in a day
if (ageInDays > 90) {
return 3
} else if (ageInDays > 60 && ageInDays <= 90) {
return 2
} else if (ageInDays > 30 && ageInDays <= 60) {
return 1
} else {
Not sure if I can create this but thank you for your answers!
Thanks!
It looks like you're new here. Sign in or register to get started.