Check that all issues that this one is blocked by are resolved. You might want to put this on the Resolve Issue transition.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLink

def linkType = ["Blocks"]

def linkMgr = ComponentAccessor.getIssueLinkManager()
for (IssueLink link in linkMgr.getInwardLinks(issue.id)) {
    if (linkType.contains(link.issueLinkType.name)) {
        if (!link.sourceObject.resolutionId) {
            passesCondition = false
        }
    }

}

Have questions? Visit the Atlassian Community to connect, share, and learn with other Atlassian users and experts, including Adaptavist staff.

Ask a question about ScriptRunner for JIRA, Bitbucket Server, or Confluence.

Want to learn more? Check out courses on Adaptavist Learn, an online platform to onboard and train new users for Atlassian solutions.