Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • Community
  • Q&A
  • Jira
  • Questions
  • Scriptrunner Workflow condition is not hiding the transition in issues when it computes to false

Scriptrunner Workflow condition is not hiding the transition in issues when it computes to false

Justin Volden December 6, 2017

Hello,

I have a condition I wrote to hide a transition unless there is an issue with the type "Problem" linked to the current issue. When I test the code in ScriptRunners code console against different issues it results in True and False as would be expected for the test issues. The problem is when I put in in the workflow on the transitions condition tab the transition never gets hid. I write to the log the result of the condition and can see the false result, but the transition is still available. Thoughts on what I am missing/not understanding causing the transition to still show even when the below code results in False?

 

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

Boolean passesCondition = false
def type =[]

def linkMgr = ComponentAccessor.getIssueLinkManager()


for (IssueLink link in linkMgr.getOutwardLinks(issue.id)) {
    type.add(link.getDestinationObject().getIssueType().name)
}
for (IssueLink link in linkMgr.getInwardLinks(issue.id)) {
    type.add(link.getDestinationObject().getIssueType().name)
}

for (item in type) {
    if(item == "Problem"){
        passesCondition  = true
    }
}
passesCondition
log.warn (passesCondition)

 

1 answer

0 votes
Justin Volden December 6, 2017

Quick easy fix from closer reading of the examples.

 

I am declaring passesCondition as a Boolean in my code. It's a special variable in scriptrunner apparently and does not need to be declared. I removed the deceleration and all started working.

Suggest an answer

Log in or Sign up to answer