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.
If even one condition is false, the result value must be false.
For example, when issue type = 10609 & link type = 11100, issue type = 10610 & link type = 11100, issue type = 10609 & link type = 11111, and issue type = 10610 & link type = 11111, validation should be false.
when issue type = 10609 & link type = 11100 and issue type = 10609 & link type = 11111, validation should be true.
I posted this to the https://community.atlassian.com but nobody answered.
I tried like below, but it doesn’t work properly.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.context.IssueContext
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.link.IssueLink
import utils.*
def links = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId())
def linkId = “11100” //TEST link
if(links != null) {
for(link in links) {
if(link.getLinkTypeId() == Integer.parseInt(linkId)) { // TEST link
def linkedIssue = link.getDestinationObject()
if(linkedIssue.issueTypeId == “10609”){ // Release issuetype
return true
}
}
else {
if(link.getLinkTypeId() == Integer.parseInt(linkId)) { // TEST link
def linkedIssue = link.getDestinationObject()
if(linkedIssue.issueTypeId != “10609”){ // Release issuetype
return false
}
} else {
if(link.getLinkTypeId() != Integer.parseInt(linkId)) { // TEST link
def linkedIssue = link.getDestinationObject()
if(linkedIssue.issueTypeId == “10609”){ // Release issuetype
return true
}
} else {
if(link.getLinkTypeId() != Integer.parseInt(linkId)) { // TEST link
def linkedIssue = link.getDestinationObject()
if(linkedIssue.issueTypeId != “10609”){ // Release issuetype
return true
}
}
}
}
}
}
} else {
return true
}
Please help me.