Hi, atlassian community !
I try add condition in post-function, but my code not worked..
My goal:
Start post -function "Set Field Value Post Function", if in current issue have "issuelink" ,
and in itat least one issuelink has "issue type" = test
My code :
def list= issue.getLinkedIssues() //result value : [TENDER-25937, ATL-2925]
//if in array have issue in issuetype == 'test' -> return true
list.eachWithIndex{ elLinkIss, i ->
if (elLinkIss.issueType.name == "test"){
return true
}
}
Thank you any help!
I maked code . I hope this helps.
(pay attention to Boolean logic)
arrLinkedIssue = issue.getLinkedIssues() //[TENDER-25941, ATL-2925] Result type:ArrayList
issLi = []
def issueManager = ComponentAccessor.issueManager
for(i in arrLinkedIssue) {
issueLinkKey = issueManager.getIssueObject(i.toString())
issType = issueLinkKey.get("issuetype").name
issLi.add(issType)
}
//return issLi [Bug, Task]
if('Bug' in issLi){
return false // The task contains a linked task with the task type "Bug" -> Post-function not start!
}
else{ //The task does not have a link task with the task type "Bug" or there is no link at all (null) -> Post-function is launched!
return true
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.