Linked Issue Validator

Sharone Shani May 25, 2021

Atlassians:

I need to be able to prevent a workflow transition based on the status of a linked ticket.

Main ticket is of one issue type and has a linked ticket of another issue type.

Transition of Main ticket from status A to status B should be allowed ONLY if the linked ticket is in the "Done" status.

I have tried utilizing the "Validation of linked issues" validator, properly (at least it looks right to me) setting up all the properties of the validator.

The result is: Moving the Main ticket from status A to B (as explained above) when the linked ticket is NOT in "Done" is not allowed by the validator (works as expected).

HOWEVER - Moving the Main ticket from status A to B when the linked ticket IS "Done" is also not being allowed by the validator (does NOT work as expected).

What am I missing? (I tried the same with "Condition" > same results)

2 answers

0 votes
Sharone Shani May 25, 2021

Just got it to work with the native Validator!!

it was a matter of setting up the right "direction" for the properties.

The key was to set up the "Issue link types" to the target ticket for which I want to check the status and indicate the "done" status.

I'm pretty sure I've tried that combination before, but who knows. It suddenly "started" working.

Thanks to all who read and thought about my question. :)

Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2021

Great! Glad to hear.

0 votes
Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2021

If you have a scripting app, such as ScriptRunner or JMWE, you can use a validator script like we have done. 

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

//Outward links, where we'll find any "is linked to PCE" links
def issueLinks = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId())
def numClosedPceIssues = 0

//Inward links, where we'll find any "is request for project" links
def inwardIssueLinks = ComponentAccessor.getIssueLinkManager().getInwardLinks(issue.getId())
def numProjectIssues = 0

def linkedObject

//check outward links for "is linked to PCE" links
for(IssueLink i in issueLinks)
{
//want only PCE links
if(i.getIssueLinkType().getName() == "PCE")
{
linkedObject = i.getDestinationObject()
//want only PCE issues with resolution of Complete
if(linkedObject.getIssueType().getName() == "PCE" && linkedObject.getResolution()?.getName() == "Complete")
{
numClosedPceIssues++
}
}
}

//if there are no linked closed PCEs, check inward links for "is request for project" links
if(numClosedPceIssues == 0)
{
for(IssueLink i in inwardIssueLinks)
{
//want only Project links
if(i.getIssueLinkType().getName() == "Project Portfolio Link")
{
linkedObject = i.getSourceObject()
//want only Project issues
if(linkedObject.getIssueType().getName() == "Project")
{
numProjectIssues++
}
}
}
}

return numClosedPceIssues > 0 || numProjectIssues > 0
Sharone Shani May 25, 2021

I don't have a scripting app (I know...I know).

Is it possible to do with the native, built-in Validator?

Payne
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2021

Not that I know of, but maybe someone else will chime in with a way. :-) 

Suggest an answer

Log in or Sign up to answer