I'm not very proficient in English, so I might be mistaken, but I want to put the count of child issues with a status of 'Closed' in the parent issue's field using Jira Automation. Can you please advise me on how to do this?
Hi @koutarou ishibashi - You need to have a Scripted field which is available via Script Runner Plug-in and do something like below
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.search.SearchProviderimport com.atlassian.jira.jql.parser.JqlQueryParserimport com.atlassian.jira.web.bean.PagerFilterdef jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)def searchProvider = ComponentAccessor.getComponent(SearchProvider)def customFieldManager = ComponentAccessor.getCustomFieldManager()def customField = customFieldManager.getCustomFieldObjectsByName("FieldName").first()def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()// jql query to get the Child Issues with Closed issuesdef query = jqlQueryParser.parseQuery("issueFunction in issuesInEpics('project in (MyProject) AND status = "CLOSED')")def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter())//Get Resultsdef result = searchService.search(jobUser, query, PagerFilter.getUnlimitedFilter())def issues= result.getResults()//log.warn("issues are" + issues)return issues
Hi @koutarou ishibashi
If you want to use automation, you can use something like this
"Word Count" is a convenient numeric in my setup.Its value is being set to
{{lookupIssues.size}}
that is the results of the JQL lookup
There are pros and cons to using editable fields vs read-only scripted fields that would depend on your use case.
What are you trying to solve?
Thank you for your answer. It was solved by implementing it as I was taught.
Thank you for your answer. JIRA Automation solved it
If one of the answers solved your query, could you mark it as answer accepted for other members to find.
It looks like you're new here. Sign in or register to get started.