Transition Issue Post-Function with Conditional Execution

Deleted user December 3, 2015

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 votes
Answer accepted
Peter Bengov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2015

Hi Jake, 

Try the following syntax 

if (cfValues['FIELD NAME'].getValue() == 'FIELD VALUE'){
...
}
Deleted user December 9, 2015

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

Deleted user December 9, 2015

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?

Deleted user December 9, 2015

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
TAGS
AUG Leaders

Atlassian Community Events