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 Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

152 views 1 17
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