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

This widget could not be displayed.
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
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

258 views 1 3
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