Forums

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

Extract parent issues and all it's sub issues.

akukkuje August 7, 2020

Hi,

 

Is there a way to extract sub issues along with the parent issue while using a JQL with the parent filter field?

Example: https:base/rest/api/3/search?jql=project=TEST+and+cf[10814]~'user@test.com' 

 

Note:

cf[10814] =  parent field

 

Currently, I'm able to extract only parent issues and I'm missing sub issues.

2 answers

2 accepted

3 votes
Answer accepted
Jack Nolddor _Sweet Bananas_
Atlassian Partner
August 10, 2020

Hi,

Sadly you cannot achieve the desired search using standard features on Jira, you must go for a third-party app instead. Using i.e. JQL Booster Pack (if you are on Server / DataCenter) you can type the following:

 

1) A bunch of issues

project = PL AND issuetype = Task AND fixVersion = "v1.2" 

 

2) Find all subtasks under a given issues

issue IN subtasksOf(' project = PL AND issuetype = Task AND fixVersion = "v1.2"   ')

(*) Note that this is just an example, you must tune above query to fit your needs.

 

Using this app you can also query other issues relations, check:

Regards

1 vote
Answer accepted
Ste Wright
Community Champion
August 7, 2020

Hi @akukkuje 

What kind of parent field is it? If I'm reading the above right, Parents are usually not email addresses!

Ste

akukkuje August 7, 2020

Hi @Ste Wright 

 

It's a custom field and using this custom field to store some email address and I'm trying to filter issues based on the value in the custom field.

Please note: The above custom field is not present in sub issues.

 

currently, I'm able to get only the list of parents but not their sub issues in the final response.

 

I'm trying something like: key in subtasksOf(jql)

Ste Wright
Community Champion
August 7, 2020

Hi @akukkuje 

Just to confirm, you want to see:

  • All the issues in project Test...
  • Which contain that email address in a custom field and...
  • All the children of those parent issues that contain this email address?

You mention subtasksOf - this kind of JQL function is only available via an app, allowing you to include a sub-query.

Apps such as ScriptRunner allow you to have:

issueFunction in subtasksOf("project = TEST AND cf[10814] ~ 'user@test.com'") or project = TEST AND cf[10814] ~ "user@test.com"

^ This gives you the sub-tasks below the parent issues, and the parents themselves

This is the actual JQL, which you could for the REST API call.

Ste

akukkuje August 7, 2020

@Ste Wright  thanks for your suggestion. 

I found "key in subtasksOf(jql)" while searching on google. 

 

Can we do the above task using cloud REST API?

Ste Wright
Community Champion
August 7, 2020

Hi @akukkuje 

Potentially - you'd be best to attempt this on your instance as you have the custom field.

I'm not as strong with the REST API, but something like this after "jql=" might work:

issueFunction%20in%20subtasksOf("project%20%3D%20TEST%20AND%20cf%5B10814%5D%20~%20%27user%40test.com%27")%20or%20project%20%3D%20TEST%20AND%20cf%5B10814%5D%20~%20"user%40test.com"

Ste

akukkuje August 7, 2020

@Ste Wright 

 

I'm getting the below error:

"Field 'issueFunction' does not exist"

 

URL: https://base/rest/api/3/search?jql=issueFunction%20in%20subtasksOf("project%20%3D%20TEST%20AND%20cf%5B10814%5D%20~%20%27user%40test.com%27")%20or%20project%20%3D%20TEST%20AND%20cf%5B10814%5D%20~%20"user%40test.com"

Ste Wright
Community Champion
August 7, 2020

Hi @akukkuje 

Do you have the app I mentioned? If not, this function won't work.

You'd need an app which extends the ability of JQL, like ScriptRunner - or you can search for an alternative app on the Marketplace

If you choose an alternative app, ensure it has the function you're looking for, and it might modify the JQL slightly as not all apps use the same phrases :)

Ste

Like akukkuje likes this
akukkuje August 7, 2020

@Ste Wright 

 

Oh, okay. Currently, I don't have the above app. 

I'm trying with postman and using just  a REST call.

Is there any alternative REST call or format?

Ste Wright
Community Champion
August 8, 2020

Hi @akukkuje 

Not that I know of I'm afraid - but another member of the community might have their own idea :)

Ste

akukkuje August 8, 2020

@Ste Wright sure, thanks for the above suggestions.

Suggest an answer

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

Atlassian Community Events