Problem:
Prevent the workflow transition "Done" from showing up if there are any "is blocked by" linked issues that are not "Done"
Scenarios:
In this scenario, I DO NOT want to see an option to move the Story A status to "done"
- Story A (current status=in progress)
- is blocked by Story B (current status = done)
- is blocked by Story C (current status = to do)
- relates to Story D (current status = to do)
In this scenario, I DO want to see an option to move the Story A status to "done"
- Story A (current status=in progress)
- is blocked by Story B (current status = done)
- is blocked by Story C (current status = done)
- relates to Story D (current status = to do)
Attempted Solution:
In the workflow, I've added a scripted condition, however the "Done" status is still an option for the user and I'm able to complete the "Done" transition. 
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLink
def linkType = ["is blocked by"]
def linkMgr = ComponentAccessor.getIssueLinkManager()
for (IssueLink link in linkMgr.getInwardLinks(issue.id)) {
if (linkType.contains(link.issueLinkType.name)) {
if (! link.sourceObject.resolutionId) {
passesCondition = false
}
}
}
I used this link as my reference. https://scriptrunner.adaptavist.com/5.0.2/jira/recipes/workflow/conditions/all-dependent-issues-resolved.html
Any advice ??