Forums

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

Using the {{lookupIssues}} to find number of issues in an Epic

Jeffrey Bistrong
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 30, 2021

Really excited about the new Jira Work Management tool, and I am doing a POC for our professional services team to manage various projects with external customers by this team. 

 

I am looking for a way to automate a status change based on the number of "Risks" that have been identified. 

I have an epic for each project that is being worked on. If a risk is identified within that project, a ticket with issuetype = Risk will be created within the epic. 

 

I would like to automate the status change of the Epic, if there are 2 or more tickets (with issuetype = risk)

I have setup the following logic to try and return the number of risks within an epic, but it is currently not returning a value. I suspect because the lookup is inside of the (issue in epic)

 

Additionally, even the "{lookupIssues.size}}" within the branch is returning the total count, and not the count per epic

 

Automation rules - JIRA 2021-04-30 16-40-49.png

 

5 answers

1 accepted

8 votes
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 25, 2013

That's not quite true - resolution date is not always closed date.

The answer to the question givein is simply "look in the issue history", but I suspect there's a further question, in that the poster will want to report on the date directly (for example "closed date < -7d"). JQL doesn't let you interrogate the history quite that easily, and most places won't display the date either (the issue navigator only displays fields, not "stuff we extracted from the history").

To solve this problem in the future, the most easy option is to add a "closed date" date/time field and use a plugin to give a transition post-function that sets this date to "now" when any close transition is used.

Susan Esher
Contributor
October 25, 2013

Thanks Nic. You are correct. I know where to find dates in issues and I know how to do advanced queries. However, there is no Closed date anywhere that I can query on that I can find and you have confirmed that. I will look to the transition post-function as a solution. Thanks.

Like Lukasz Slodziak likes this
1 vote
Vidic Florjan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 25, 2013

Andrey's plugin is nice. You can also createcustom field called Script Field with Scriptrunner plugin to get this information automatically.

Link to documentation how to create Script field:

https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+Fields?src=contextnavchildmode

Code for this Script Field:

import com.atlassian.jira.ComponentManager
def componentManager = ComponentManager.getInstance()
def changeHistoryManager = componentManager.getChangeHistoryManager()
changeHistoryManager.getChangeItemsForField(issue, "status").find {it.toString == "Closed"}?.getCreated()

Royce Wong
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 13, 2018

What if the issue gone through a cycle and closed multiple times? What would this scripted field return?
The first time the issue was closed? Or the last time?

Tammy Robinson
Contributor
January 17, 2019

As Royce pointed out above...

Does anyone know how to use this logic similarly to get the LAST time the issue was Closed - in case it was allowed to Close multiple times?

Like Dave likes this
1 vote
Andrey Markelov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 25, 2013
0 votes
Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
July 6, 2015

I want to Get Closed Date from script runner with below script. It works but not exact due to Timezone difference. How can I get exact date?

 

import com.atlassian.jira.ComponentManager

def componentManager = ComponentManager.getInstance()

def changeHistoryManager = componentManager.getChangeHistoryManager()

changeHistoryManager.getChangeItemsForField(issue, "status").find {it.toString == "Closed"}?.getCreated().format('dd/MMM/yy HH:mm')

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
July 7, 2015

That's the date it was closed... the server date is authoritative. You can adjust it for display to clients, but you haven't given any context so don't know what the circumstance is.

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
July 7, 2015

@Jamie Two users - User1 at Time Zone: (GMT+05:45).This is set in user profile. User2 at Time Zone: (GMT-06:00).This is set in user profile. System/apps hosted in Time Zone: (GMT-06:00) getCreated() gives the date at Time Zone: (GMT-06:00). So User2 has no problem. But the user1 gets the date of (GMT-06:00). Whereas other dates like Resolved, Created , updated are in (GMT+05:45). I want to get Closed date in (GMT+05:45) for User1. I want generic solution that can work for any users in any Timezone.

0 votes
RicardoA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 25, 2013

Hi Susan

You can find this information inside the issue at the right corner at the resolution date.

Hope it helps,

Ricardo Carracedo.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events