Forums

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

Java script to list multiselect option based on another field

gopinath_velayudhan September 6, 2021

Hi -

I am working on a java Script when I have 2 fields one a select-list and one multiselect list and  both the lists have multiple values/options set

I need a java script that will help with the follwoing

based on the value i select from  customfield_selectlist. I should be displaying only values that are related to this selection in the customfield_multiselect

 

selectlist values = apple, orange, grapes

multiselect values = apple_1, orange_1, grapes_1, apple_2, orange_2 and grapes_2

 

if I select apple in select list. The form should only show apple_1, apple_2 and apple_3 ....

 

can someone help me with the code.

 

thanks a lot in advance

Gopi

3 answers

0 votes
Daniel Ebers
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.
September 10, 2021

Hi @gopinath_velayudhan

agreeing to what Vikrant and Fabian suggested I wanted to share that some stale Java Script adaptions in the past lead to an incident for a Jira instance we were running resulting in a downtime for several hours which in the end caused more expenses (by people not being able to work) than any App could cause.

So ... in the end it is you who has to decide but here my +1 for an App (whichever you might prefer, at least you can test all of them for some days - for free).

Regards,
Daniel

0 votes
Vikrant Yadav
Community Champion
September 6, 2021

Hi @gopinath_velayudhan  You can do this with the help of Script Runner behaviour. 

If you have script runner plugin installed then only you can apply Behaviour on a select list field. Do you have script runner ?

Thanks

V.Y

gopinath_velayudhan September 7, 2021

HI Yadav - Unfortunately we do not have Scriptrunner and wont be an option right now. 

is custom script that i can add to description that will work.

 

Thanks

Gopi

Vikrant Yadav
Community Champion
September 7, 2021

@gopinath_velayudhan  Java script is wrong way of doing this. It often doesn't work what you want it to do.

Inject Javascript modify JIRA behaviour in very strange way. There is no way to trace that from configuration point of view. More over you can't see added JavaScript code in Debugger, which makes troubleshooting very hard.

gopinath_velayudhan September 8, 2021

Unfortunately i wont be able to use any Paid plugin. Do you know of any other plugins that can help which are cheaper or free :(

0 votes
Fabian Lim
Community Champion
September 6, 2021

Hi @gopinath_velayudhan,

For your scenario I would use the power scripts plugin with the following script: https://confluence.cprime.io/display/JJUPIN/lfAllowSelectOptions

Here are instructions on how Live Fields work in jira: https://confluence.cprime.io/display/JJUPIN/How+Live+Fields+work

They provide excellent support, so feel free to contact them if you get stuck. 

Suggest an answer

Log in or Sign up to answer