I would like to validate during the workflow transition that atleast one linked issue should be unresolved to move to next status. I am trying with Jira expressions but unfortunately it's not working.
I used Jira Expressions to validate it and it worked.
issue.links.filter(L => (L.linkedIssue.resolution == null)).length > 0
Hi @Kishore Kumar Gangavath - You cannot set validations on linked behavior, but you can use a field to capture the state of linked activity and use automation to set the field accordingly. Then set the validator against that field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Making sure I understand, you want the validator to check every issue linked to the issue you are trying to transition, and only allow if if at least one of those issues are unresolved.
With scriptrunner, you can get all linked issues, step through them, and validate whether it has unresolved linked issues with something like the following as a scripted validator in the workflow transition:
import com.atlassian.jira.component.ComponentAcessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
def linkMgr = ComponentAccessor.issueLinkManager
def incomingLinks = linkMgr.getInwardLinks(issue.id)
def outgoingLinks = linkMgr.getOutwardLinks(issue.id)
// This is the flag for an unresolved linked issue
def hasUnresolvedLinkedIssue = false
// Links can be incoming or outgoing
// first we'll step through your incoming links
incomingLinks.each
{
// This is the issue your transitioning issue is linked to
def linkedIssueObj = (MutableIssue) it.sourceObject
// If the linked issue does not have a resolution
if(linkedIssueObj.getResolution() == null)
{
// Set the flag to true
hasUnresolvedLinkedIssue = true
}
}
//This is the same as above, only for your outgoing links
outgoingLinks.each
{
def linkedIssueObj = (MutableIssue) it.destinationObject
if(linkedIssueObj.getResolution() == null)
{
hasUnresolvedLinkedIssue = true
}
}
// If the flag has been set to true, return true, validating the transition
// Otherwise return false and prevent the transition
if(hasUnresolvedLinkedIssue == true)
{
return true
}
else
{
return false
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If any issue is trying to transition to a X status then for that particular issue needs to have atleast an one linked issue and that issue should not have resolution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Would you like to give me a script?
I want to set validation condition like
: if liked issue type id is 10609, and link type id is 11100 --> true
: if liked issue type id is not 10609, and link type id is 11100 --> false
: if liked issue type id is 10609, and link type id is not 11100 --> true
: if liked issue type id is not 10609, and link type id is not 11100 --> true
In sum, several types of issues may be connected with several connection types. if there is a issue type 10609, validation rule has to check whether the link type is 11100 or not.
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Show up and give back by attending an Atlassian Community Event: we’ll donate $10 for every event attendee in March!
Join an Atlassian Community Event!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.