Forums

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

Need to loop through subtasks of an issue using RESTAPI calls and groovy with ScriptRunner.

tomgross_com
Contributor
August 16, 2023

Trying to create some ScriptRunner groovy scripting on CLOUD to loop through the subtasks of an issue and delete some of the subtasks basked on their status. 

I found the server RESTAPI call to pull back the subtasks, but it doesn't work on CLOUD.

Server call:  /rest/api/2/issue/ISSUE-144/subtask

Am I missing something here?  Is there a new way to loop through subtasks on Cloud?

1 answer

2 votes
Helmy Ibrahim _Adaptavist_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 16, 2023

Hi Tom,

The REST API is different for Server and Cloud:

Therefore, for Cloud, you can try the following code to retrieve subtasks of an issue:

def subtasks = get('/rest/api/3/issue/ISSUE-144').asObject(Map).body.fields.subtasks

I hope this helps!

Kind regards,
Helmy

Lukasz Grobelny
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2023

And from there iterate through them. If you want, I can create a simple draft of the script.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events