Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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 Marketplace Apps & Integrations

Happy New Year and Welcome New Marketplace Partner Program Partners!

Happy New Year! We hope you all had a safe and restful holiday season. 2020 was a unique year full of unforeseen events; however, as we enter the new year of 2021, we’re optimistic for the light at t...

444 views 5 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you