Forums

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

Problem with ScriptRunner Behaviours

Amir Katz (Outseer)
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.
April 22, 2018

I am using Behaviours to conditionally hide/show one custom field out of four (A,B,C,D), based on the value of another (single selection) custom field (X).

When the value of X is "AA", I want to show field A and hide B,C,D. When value is "BB", I want to show B and hide A,C,D, and so on.

I am basing my code on the example given here (https://scriptrunner.adaptavist.com/5.3.16/jira/recipes/behaviours/select-list-other.html)

but what is missing from the documentation is how to set up the dependent field ("Favourite Fruit (Other),") in the relevant screen(s). In my case, if I set the field A to be shown, then it always appears on my create screen. If I set it to Hidden, it never shows. Inspecting the page does not show the field at all in the latter case.

I have another Jira server with an older version of Behaviours (when it was a separate add-on) and when I inspect the page there, the dependent field A is always on the page. When it's shown, the <div> element that wraps the field is this:

<div class="field-group" style="display:block;">

When the field is hidden by Behaviours, the div is:

<div class="field-group" style="display:none;">

Please advise.

1 answer

1 accepted

1 vote
Answer accepted
Danyal Iqbal
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.
April 23, 2018

Hi amir,

are you trying to hide the fileds B,C,D depending on A? In that case A should always appear on the create screen.

Amir Katz (Outseer)
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.
April 23, 2018

[Correction on your answer - I am showing/hiding one field out of fields A,B,C,D, depending on value of X]

But you are correct, I already set the main field (X)  to be Required and Visible.

Thanks.

Suggest an answer

Log in or Sign up to answer