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

Next challenges

Recent achievements


  • Give kudos
  • My kudos


  • 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

Prepopulation of fields using Behaviours plugin

I am using behaviours plugin to add behaviour to 2 fields consider A and B .
A is a multiple select version picker customfield and B is a single select version picker customfield.

I have modified this script to add options to A and B based on each other .
when options in A are selected option in B are automatically prepopulated
However even before i select the a option in A , the behaviour occurs and i see only "None" as the option while B is a verion picker i should be able to see the versions of the project.

Similary while i select B i am trying to prepopulate value in A but that is not happening because i cant see any option in B other than "None"

And even after i remove the option from A i am able to see the corresponding values in B , It should get removed when option is removed.

How to tackle this ?
is there something i am missing ?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted

All of the server-side scripts fire the first time the form is loaded, this is by design.

If you want all options to be available if A and B are uninitialised then you need to code that in. So only restrict the values of B if A is set. And vice versa.

I figured it out . i added a return statement in my code if no value is selected

FormField formComponent = getFieldById(fieldChanged)
FormField formSubcomponent = getFieldByName("B")
Object componentFormValue = formComponent.getFormValue()

How to set an option to a multi select version picker ? in the logs i see the values are perfect but the field disappeaars when i select a value from other field

i use below for setting values for single select and multiselect version picker . for single select its working fine .

Map fieldOptions = [:]

fieldOptions.put(vid.toString(), vname)

formSubcomponent.setFieldOptions (fieldOptions)

Do you want to set the value (setFormValue()) or set the available options (.setFieldOptions()) for the multi-version picker?

i want to set the available options (.setFieldOptions()) for the multi-version picker.

And how to clear the values in the fields when i unselect or make the field empty again ? because now when i unselect the option i am able to see the values until i select another option.

i found that the format in which a single version picker values and multi version picker values are saved is different. a single version requires

fieldOptions.put(vid.toString(), vname)

formSubcomponent.setFieldOptions (fieldOptions)

to set the value.

while, a mulitiversion picker requires only the version id


Now only have to remove values from dependant fields when options in a multi version picker are cleared.

When i set value to a multiselect version picke using setFormValue() it sets the value perfectly but when i try to set the options of the multiselect version picker using setFieldOptions() the field disappears however when i view the source of the page from the browser i see the options in the field. why the field is not visible ?

Sounds like a bug, can you report one please... The fact that you see it in the source doesn't mean much, the javascript manipulates the dom, such that it might have little resemblance to the source.

Ok , i need to set the multiversion picker options because i cant let it display all the versions of the project.

Hi Jamie ,

What might be the reason for this behaviour ? i wish this bug gets resolved soon .

Community showcase
Published in Confluence Cloud

Share your Confluence Cloud experience for a chance to win $500!

Take our 5-minute survey to win a $500 Visa gift card! Are you currently using Confluence Cloud? We want to hear from you! Fill out this quick survey about your Confluence Cloud experience so we ...

136 views 1 8
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