JIRA, Technical

JIRA Workflow Transition Condition: check_parent_resolved.py

It took a few hours to figure this hook out, so I’m including my hard-won lines of code here.

# -*- coding: UTF-8 -*-
# Check if PARENT is resolved.
# Monitoring creates Events in the Event queue, these Events
# automatically create Incident children.
# We don't want to resolve any Incident children until the parent Event
# resolves.
# (Normally you want to block on your children instead of your parent.)
from com.atlassian.jira import ComponentManager
from com.atlassian.jira.issue.link import IssueLinkManager
ilm = ComponentManager.getInstance().getIssueLinkManager()
# Assume we are okay ...
result = True
for link in ilm.getInwardLinks(issue.getId()):
    if link.getIssueLinkType().getName() == "Parent" and link.getSourceObject().getResolution() == None:
        result = False

Read More

Categories: JIRA, Technical