prevent open tasks from being closed when linked with blocker task


I recently was looking for a way to prevent open tasks from being closed when they are being blocked by other tasks and saw this example.

import com.atlassian.jira.component.ComponentAccessor
def issueLinkManager = ComponentAccessor.getComponent(IssueLinkManager)
! issueLinkManager.getInwardLinks(issue.getId()).any { == "Blocker"

I've added the code as a validator into the closing step of our workflow. This works great so far. However, when the blocker is resolved and closed, we're not able to close the main task.

How can I connect this example with checking whether the blocker is resolved or not?

Thanks for your help.

1 answer

1 accepted

This widget could not be displayed.

Something like this:

! issueLinkManager.getInwardLinks(issue.getId()).any { == "Blocker" && ! it.sourceObject.resolution

Works! Thanks a lot!

It's throwing error at &&

how do I resolve this?

Both my workflows (parent and linked issues) have Done state as the green (resolved group one?) state last one

Hi Ratna

It seems like the formatting got messed up. It should look like this.

! issueLinkManager.getInwardLinks(issue.getId()).any { == "Blocker" && ! it.sourceObject.resolution


Its still not working for me :(

Should it be "is blocked by" or "blocks" (those are the types I see under issue links). I tried both and it still lets me close the item. I added the code into the simple scripted validator option as shown

simple scripted validator.png

Hi Ratna

Neither of those will work. You have to use the name of your link. For me, that was Blocker.

Please check under Issue Links what it says under the column Name. It should be the first column.


It should be "is blocked by" for me correct? It does not work

is blocked by.png

Hi Ratna

No, that's just your inward description. Please check the column Name in your settings under issue links.


Thanks! I got it right now!! I was using the description showing on the issue instead of the actual name of the link type fro admin panel.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

511 views 3 18
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you