Forums

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

List all child issues with Scriptrunner Cloud

Jesus Octavio Gutierrez Villegas
Contributor
January 10, 2023

Hello everyone,

First of all, thank you a lot for taking several minutes to read/answer this.

 

I wish to list all the child issues of a specific Epic with Scriptrunner cloud and Jira API v2.

When doing a GET to obtain all the info of the child issue

def issue = get("rest/api/2/issue/PT-2152").asObject(Map).body

you can see "parent" and can obtain all the info of the Epic issue.

{
  "expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations,customfield_12000.requestTypePractice",
  "id": "402790",
  "self": "https://.atlassian.net/rest/api/2/issue/402790",
  "key": "PT-2168",
  "fields": {
    "customfield_15084": null,
    "parent": {
      "id": "401900",
      "key": "PT-2152",
      "self": "https://.atlassian.net/rest/api/2/issue/401900",
      "fields": {
        "summary": "acceleration test1",
        "status": {
          "self": "https://.atlassian.net/rest/api/2/status/10200",
          "description": "",
          "iconUrl": "https://.atlassian.net/images/icons/statuses/generic.png",
          "name": "New",
          "id": "10200",
          "statusCategory": {
            "self": "https://.atlassian.net/rest/api/2/statuscategory/2",
            "id": 2,
            "key": "new",
            "colorName": "blue-gray",
            "name": "To Do"
          }
        },

How can I obtain all the info of all child issues? Just as linked issues?}

{
  "expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations,customfield_12000.requestTypePractice",
  "id": "401900",
  "self": "https://.atlassian.net/rest/api/2/issue/401900",
  "key": "PT-2152",
  "fields": {
    "customfield_15084": null,
    "customfield_15082": null,
    "resolution": null,
    "customfield_10500": null,
    "customfield_15074": null,
    "lastViewed": null,
    "customfield_15077": null,
    "customfield_15078": null,
    "customfield_15076": null,
    "customfield_11700": null,
    "aggregatetimeoriginalestimate": null,
    "issuelinks": [
      {
        "id": "385004",
        "self": "https://.atlassian.net/rest/api/2/issueLink/385004",
        "type": {
          "id": "10000",
          "name": "Blocks",
          "inward": "is blocked by",
          "outward": "blocks",
          "self": "https://.atlassian.net/rest/api/2/issueLinkType/10000"
        },
        "inwardIssue": {
          "id": "402790",

Or is it not possible?

The point of this, I need to compare all childs' status to define the Epic status, so for example: If most of my childs are in "Open" status, my Epic will be also in Open or related status. 

Thanks a lot for your answers!

1 answer

1 accepted

1 vote
Answer accepted
Jesus Octavio Gutierrez Villegas
Contributor
January 11, 2023

I resolved my issue with this code:

def jql = '/rest/api/2/search?jql="Epic Link"=STP-54'
jql = jql.replace(" ","%20").replace('"',"%22")
def ids = get(jql).asObject(Map).body

 

Basically you can JQL search with that. hope this helps!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events