Forums

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

Behaviour: Field Shows As Not Required, But Still Somehow Required

Colin_Fagras November 14, 2018

I'm struggling to get the following (partial) code working for a ScriptRunner Behaviour. In the issue create screen when the first set of criteria is met, JIRA does show that the 3 fields in question are no longer required by removing the red * next to them. However, it still won't let the user proceed and pops up a message saying those 3 fields are required....

if (sportsPageType == "In App" && vertical.size() == 1) {
imagesRequiredField.setRequired(false)
exposureRequiredField.setRequired(false)
}
else {
imagesRequiredField.setRequired(true)
exposureRequiredField.setRequired(true)
}

stillrequired.jpg

Anyone ever seen that before? Where it removes the required * flag successfully but the field is still somehow required? Driving me bonkers.

1 answer

0 votes
Colin_Fagras November 14, 2018

The fields in question are radio buttons in this example. Is the problem that I have the custom fields set to REQUIRED in JIRA itself? This is because they need to be required for other configuration variations.

If that's the problem I guess I could make them optional but I want to force the user to make a selection and don't want to present a default value. But I also don't want JIRA injecting an automatic None option when they are optional with no default value.

Could I make them optional in JIRA with a default value set but then reset that to a null value in my ScriptRunner Behaviour for the field to effectively reset it, forcing the user to select one or other?

Roland Holban (Adaptavist)
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.
November 19, 2018

This does sound like a conflict between the behaviour and Jira. Try to mark them optional in Jira and use the toggle button to mark them required in your behaviour. Then in the script you can write your logic to un-require them whenever needed.

Screen Shot 2018-11-19 at 11.22.35 AM.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events