how to get stories list which are not in closed state and task relates to story (same) is closed status.
For a given project in JIRA, wanted to get the list of stories are not closed but tasks relates to this story got closed.
In my project story contains multiple tasks, each task handled by different user, as and when tasks are in closed status, we should change Story status to close. wanted to get the list of stories which are not closed but Task (issue type) relates to this story are in closed state.
Query: project = "Project name" AND type = Story ) AND assignee = current user AND status != Closed , and have analyse each story and change to close. So looking for option here . this Query gets stories but wanted stories and tasks of that stories in closed status.
So, if you can't use an addon, i will suggest you to use jira python, here a code that i tried today (i'm not an expert but it's working)
from jira import JIRA
jira_cloud = JIRA(basic_auth=("username", 'token_cloud'), options={'server': 'https://jira_url/'})
issues_Jql = 'project = "ABC" and type = story'
my_issue = jira_cloud.search_issues(issues_Jql)
issue_list = []
for story in my_issue:
for issue_task in story.fields.issuelinks:
if hasattr(issue_task,"inwardIssue"):#look for the inward linked (the task issue type)
linked_task = jira_cloud.issue(issue_task.inwardIssue.key)
if str(linked_task.fields.status) == "To Do":#status name that i'm looking for
issue_list.append(story.key)
issue_list.append(linked_task.key)
key_list = ""
for i in issue_list:
key_list= key_list + i+","
key_list = key_list[:-1]#remove the last comma
jql_list = f"project = ABC AND issuekey in ({key_list})"
print (jql_list)
This code will return a jql with the story and linked task that are in to do status.
Or you can use google sheet and use 2 different jql one for the story and another one for the task and work on it to have everything in one sheet.
Hope this helps
Thank you @Mohamed Benziane , it is helping some extent. little work around but great helps. thank a lot.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Mohamed Benziane @Indu with PIP we are success .
global str
from jira import JIRA
jira = JIRA(basic_auth=("user ID", 'password'), options={'server': 'https://jira.xyz.com'})
for issue in jira.search_issues('project = XX AND type = "Story" AND assignee = "current User" AND status != "Closed" AND labels = new', maxResults=100):
if (issue.fields.issuelinks):
#print('{}: {}'.format(issue.key, issue.fields.status))
if str(issue.fields.status) != "Closed":
for links in issue.fields.issuelinks:
if hasattr(links, "outwardIssue"):
outwardIssue = links.outwardIssue
if str(outwardIssue.fields.status) != "OPEN":
print(outwardIssue.key,outwardIssue.fields.status,issue.key,issue.fields.status)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please see if this helps
https://docs.automationforjira.com/issues/branching.html#related-issues-condition
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
apart from Add-on, any other solution?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
a third part plugin JQL Search Extensions for Jira & reports is available on Cloud which can solve your issue.
I create your scenario and its successfully returning the results.
What you need to do is.
(subTaskOfQuery="subquery" and status="closed") or issuesInQuery="subquery"
Please note that "subquery" is the alias of the sub query. This query will return
stories list which are not in closed state and task relates to story (same) is closed status.
Here is the documentation , how to use it
https://jqlsearchextensions.atlassian.net/wiki/spaces/SEARCH/pages/173211649/Subqueries+-+Jira+Cloud
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
The task are linked to your storie ? So to achieve what you want you'll need a plugin like Scriptrunner:
https://scriptrunner.adaptavist.com/4.3.4/jira/jql-functions.html#_linkedissuesof
It provides a JQL function that find linked issue with specific status.
edit : As @Lenin Raj asked, if by task you meant subtask you will also need an addon like scriptrunner too.
https://scriptrunner.adaptavist.com/4.3.4/jira/jql-functions.html#_hassubtasks
Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, Im not looking any add-on. Add-on required to add by Admin/Dev ops. this is forbidden in my case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you say 'tasks', do you mean 'sub tasks'?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Lenin Raj it is not the sub tasks,. it is issue type =task (in my project) and we are using option called "relating to" as shown in picture.. any comments
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, so you will need an-addon, you can look at my answer below.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, im not looking any add-on. Add-on required to add by Admin/Dev ops. this is forbidden in my case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.