We have tried a few jql and script runner advanced queries to show all open and resolved tasks and subtasks in a given project that are linked to epics that are open. The query should exclude any issues that are tied to a resolved epic.
Suggested scripts like issueFunction in issuesInEpics ("project=JRA and status = 'to do, in progress, approved'") do not return issues and provide an error
Any suggestions would be greatly appreciated.
Hi Neil,
The script you have over there is for ScriptRunner for Server, you can find a Cloud version of that script at Script Library - Calculate the difference between two dates
Hope that helps
Thanos
Thanks Thanos. Yes, I assumed this was the Server version.
I'm not a coding expert but he code below appears to indicate you have to hard-code the issuekey.
How would I amend the code so, within a workflow (post function), the code returns the difference in days between two custom fields ("Analysis Date" and "Ready Date") for the issuekey being transitioned in the workflow?
What parts of the code below would I have to change?
Thanks for your help.
Neil
def issueKey = 'TEST-1'
//Pick a date that you would like to calculate from
def issueFieldId = getFieldIdFromName('Reqs Agreed Date')
//You can even use built-in field ids, like resolutiondate
resolutionFieldId = 'resolutiondate'
def reqagreeddate = new Date().parse('yyyy-MM-dd', getIssueField(issueKey, issueFieldId))
def resolutionDate = new Date().parse('yyyy-MM-dd', getIssueField(issueKey, resolutionFieldId))
def dateDifference = resolutionDate - reqagreeddate
return dateDifference + ' Days'
def getIssueField(issueKey, fieldId) {
def issueFieldValue = null
def result = get('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.asObject(Map)
if (result.status == 200) {
result.body.fields.each { key, value ->
if (key == fieldId) {
issueFieldValue = value.toString()
}
}
logger.warn issueFieldValue
return issueFieldValue
} else {
logger.warn "Failed to find issue: Status: ${result.status} ${result.body}"
return null
}
}
def getFieldIdFromName(fieldName) {
def customFieldObject = get('/rest/api/2/field').asObject(List).body.find { it.name == fieldName
}
return customFieldObject.id
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would like the result (dateDifference) to be stored in custom field "Cycle Time")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would like the result (dateDifference) to be stored in custom field "Cycle Time" so it can be queried with JQL.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The code copied from the adaptavist link provided doesn't compile. It throws up lots of errors when pasted into the "Script Context"
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.