Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,361,824
Community Members
 
Community Events
168
Community Groups

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

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
Community showcase
Published in Apps & Integrations

Apps for Confluence you won't want to miss: RSVP for September's Appy Hours

Calling all collaborators and Confluence users! Our Appy Hours event on September 29th features 4 presenters demoing functionality to superpower Confluence. Don't miss learning about these apps i...

125 views 0 9
Read article

Atlassian Community Events