Transition Issue Post-Function with Conditional Execution

Hello,

I feel like a total newb here. I'm just trying to transition an issue through the post-function on the condition that the value of a custom field is "Yes":

 

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import org.apache.log4j.Category

if(issue.get("customfield_12106") == "Yes"{
return true;
}

log.debug("Debug message")
The custom field is a simple radio button with the values of 'No' and 'Yes'. I've also tried the value optionID of "12131":
if(issue.get("customfield_12106") == "12131"
I'm certain the object type isn't defined properly, or I'm missing a method or class, or I forgot to do something.
Bottom line, I just want the post-function to run, which runs fine with no Conditional Execution, when the value of a custom field is "x".
Thank you,
Jake

1 answer

1 accepted

0 vote
Peter Bengov Community Champion Dec 06, 2015

Hi Jake, 

Try the following syntax 

if (cfValues['FIELD NAME'].getValue() == 'FIELD VALUE'){
...
}

Peter, you are a good man. I'll test this today and let you know.

Peter, this works beautifully: if (cfValues['SendEmail'].getValue() == "Yes"){ return true } However, this only works in the Simple Scripted Condition. I get an error when executing this using a post function: groovy.lang.MissingPropertyException: No such property: cfValues for class: Script1 Any thoughts?

I ended up using the condition instead of the post-function and it worked fine. Thanks.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

49 views 0 4
Read article

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