How to use a Radio Button to validate a transition

Karl Samson
Contributor
July 25, 2024

I'm trying to setup a 'Simple Scripted Validator' using ScriptRunner. That allows the transition, if the Radio button in question has 'No' selected.

 

 

"import com.atlassian.jira.component.ComponentAccessor

// Get the custom field manager
def CustomFieldManager = ComponentAccessor.getCustomFieldManager()

// Get the custom field by name
def approvalField = customFieldManager.getCustomFieldObjectsByName("Verification?")

// Get the value of the custom field for the current issue
def approvalValue = issue.getCustomFieldValue(approvalField as String)

// Check if the custom field value is not "Yes"
return approvalValue != "Yes"

    return true"
The Script Editor likes the code, but the transition is blocked, whether 'Yes' or 'No' is selected!? 
Can anybody show me where my code is wrong please?
Thanks.

1 answer

0 votes
Jim Knepley - ReleaseTEAM
Atlassian Partner
July 25, 2024

I think that getCustomFieldObjectsByName returns a collection of CustomField objects and you're looking at that collection as though it's a discreet "yes/no" value.

Try something simpler:

def approvalValue = issue.getCustomFieldValue("Verification?")

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.12.8
TAGS
AUG Leaders

Atlassian Community Events