Forums

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

GROOVY_CHILDS_Parent Link

Mateusz Janus September 26, 2025

Hello Jira Ninjas! I need help

1. I have Jira Data Center with Advence Roadmap Plan

2. My Ticket Type hierarchy looks like below
a. GROUP

b. Initiative

c. EPIC

d. Story/Task/BUG

3. when i create child/parent relation between EPIC and story i use EPIC LINK FIELD

4. when i create child/parent relation between GROUP and INITATIVIE and EPIC i use PARENT LINK FIELD

5. I dont have childOf() funtion available in JQL but i have valid SCRIPT RUNNER

6. I am not groovy expert... but i already know there is a way to create such funtion

Can you help me run the groovy script which returns all CHILDS of GROUP ticket or at least ALL initatives childs of parent GROUP?

I am expecting results i.e. issueKey= ABC and script (or function) will return all CHILDS (INITIATIVE, EPICS, and STORIES) or at least only 1st level childs i.e. INITAITIVES.

 

THANK U!!!! in advance

1 answer

0 votes
Mateusz Janus September 26, 2025


import
com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.link.IssueLinkManager import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.issue.fields.layout.field.FieldManager // Pobierz IssueManager i CustomFieldManager def issueManager = com.atlassian.jira.issue.IssueManager def customFieldManager = com.atlassian.jira.issue.fields.layout.field.FieldManager // Klucz problemu nadrzędnego def parentIssueKey = "ENGI-629" // ticket sample key def parentIssue = issueManager.getIssueObject(parentIssueKey) assert parentIssue != null : "no issue find ${parentIssueKey}!" // Pole Parent Link (customfield_10101) def parentField = customFieldManager.getCustomFieldObject("customfield_10101") // search issues for Parent Link def allIssues = issueManager.getIssueObjects() def initiatives = allIssues.findAll { issue -> if (issue.issueType.name != "Initiative") return false def parentVal = issue.getCustomFieldValue(parentField) if (parentVal != null) { def parentK = parentVal instanceof Issue ? parentVal.key : issueManager.getIssueObject(parentVal.toString())?.key return parentK != null && parentK == parentIssue.key } return false } // return key

 This is what i achieved after 1 week of simulations but still get ERROR withut detailed LOG.

Suggest an answer

Log in or Sign up to answer