The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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?")

 

DEPLOYMENT TYPE
SERVER
VERSION
9.12.8
TAGS
AUG Leaders

Atlassian Community Events