Workflow transition script condition always true

Hi there,

I'm using ScriptRunner 5.2.2 and Jira 7.6.0 (server) versions. I'm trying to write a workflow transition scripted condition, but it always evaluates to TRUE. I tried returning false, or setting passedCondition to false, as the only statement in the script, and it still evaluated to true. Is it possible that it's a compatibility issue.

For reference, the whole script:

import com.atlassian.jira.issue.customfields.option.Option

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.issuetype.IssueType
import org.apache.log4j.Level
import org.apache.log4j.Logger

def customFieldManager = ComponentAccessor.getCustomFieldManager()

List<Integer> cfArray = Arrays.asList(15052,15054,15055,15344,15056,15440,15062,15057,15060,15061);

passedCondition = false

for (Integer cfId in cfArray) {
def cf = customFieldManager.getCustomFieldObject(new Long(cfId))

if (cf != null) {
Object cfValue = issue.getCustomFieldValue(cf)

if (cfValue != null) {
passedCondition = true
}
}
}

1 answer

1 accepted

1 votes
Alexey Matveev Community Champion Jan 22, 2018

Hello, 

It must be 

passesCondition = false

In your code it is passeDCondition. Try to write just a single line in your codition

passesCondition = false

The button must be hidden in this case

Ahh, right. Feeling stupid about the typo. Thank you very much Alexey. That was it.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,775 views 11 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot