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.
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.ComponentAcessorimport com.atlassian.jira.issue.Issueimport com.atlassian.jira.issue.MutableIssuedef linkMgr = ComponentAccessor.issueLinkManagerdef incomingLinks = linkMgr.getInwardLinks(issue.id)def outgoingLinks = linkMgr.getOutwardLinks(issue.id)// This is the flag for an unresolved linked issuedef hasUnresolvedLinkedIssue = false // Links can be incoming or outgoing// first we'll step through your incoming linksincomingLinks.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 linksoutgoingLinks.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 transitionif(hasUnresolvedLinkedIssue == true){ return true}else{ return false}
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.
@padraik
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
It looks like you're new here. Sign in or register to get started.