Forums

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

How to automatically set 'status' of parent tasks to blocked if any child is blocked?

Utsav
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 25, 2024

Hello community,

I wanted to write a scriptrunner code to automate something in Jira.

I have many parent tasks (think Features-> Epics -> Stories -> More children)

I want to write a code that will automatically set a 'Feature' to blocked if any of its children are blocked. And all the parents in the chain should be blocked as well. 

For example:

If a child is blocked then - Stories, Epics and Features should also be 'Blocked'

I am fairly new to this, and I just learnt of scriptrunner, so detailed explanations will be appreciated.

2 answers

3 votes
Kristian Walker _Adaptavist_
Community Champion
January 29, 2024

Hi Utsav,

I can confirm that you can achieve this requirement using the ScriptRunner for Jira Cloud Add-on.

The way that you would do this would be to configure a script listener, which would run on the Issue Updated event.

The script would start by calling the Search for Issues API to run a JQL search to return the child issues with a blocked issue.

If any issues are then returned for those issues, it will then add an issue link to them from the parent issue with the blocks issue link to mark the parent issue as a blocker using the Create issue link API.

I can confirm I have created an example script located here, which you can refer to as a reference to help you to make the script that you need to achieve your requirements.

Finally, as an extra,  I can confirm if you want to transition the parent issue to a blocked status, then you can do this by adding a rest call to the Transition Issue API, and we have some example code of how to do this here.

I hope this information helps.

Regards,

Kristian

0 votes
Fabian Lim
Community Champion
January 25, 2024

Hi @Utsav

Welcome to the community!

If you want to keep it simpler, you can use Jira Automation with the following:

- Action: status transitioned to "Blocked"

- Conditions: issue type is epic/story/children

- Action: Branch to to the parent

- condition: if it's not "blocked"

- action transition to blocked

 

You can create one rule or be specific to each issue type and change the branch automation condition. Link: https://support.atlassian.com/cloud-automation/docs/branch-automation-rules-to-perform-actions-on-related-issues/

Eventually, when the children moves to block, then story will run, then it's epic.  

Good luck

Suggest an answer

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

Atlassian Community Events