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

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 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 ...

3,080 views 13 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