ScriptRunner Behaviours - Optional labels do not disappear for required checkboxes custom fields

David Berclaz
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 25, 2020

Hi community,

I am showing/hiding fields in my Jira Service Desk requests using ScriptRunner Behaviours.

When those fields are visible, they should be required.

def triggerField = getFieldById("customfield_11227")
def hiddenField = getFieldById("customfield_11228")

def isSelected = ((String)triggerField.getValue())?.contains("Oui")

if (isSelected){
    hiddenField.setHidden(false)
    hiddenField.setRequired(true)
}
else{
    hiddenField.setHidden(true)
    hiddenField.setRequired(false)
}

It works well with most custom fields:

  1. The (optional) label next to the field disappears when the field becomes visible
  2. There is an error message when trying to save with the field not defined

But it does not work when the custom field is a Checkboxes custom field:

  1. The (optional) label next to the field do not disappear when the field becomes visible
  2. There is an error message when trying to save with the field not defined, and the (optional) label disappears only at that moment (after submitting)

What could explain this different behaviour of Behaviours? ;-)

Thanks for your help!
Cheers,

David

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events