Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Show/Hide custom field based another another field value selection using Scriptrunner

What is the easiest way to show or hide a field (A) based on what the value is in another single select field (B) ? I used to put something in the field configuration scheme on the single select field A but that no longer seems to work. 

We have Scriptrunner and so I was trying to use a behaviour but the field does not appear at all and I cannot find a dummies guide to walk me through this example. So far I have:

 

def fieldIsBMTheLM = getFieldById("customfield_30450")   <---- B
def fieldBookingManager= getFieldById("customfield_30551") <------ A
def bookingManagerRequired = fieldIsBMTheLM.getValue();


if (bookingManagerRequired == "No") { //No
fieldBookingManager.setHidden(false)

}
else {
fieldBookingManager.setHidden(true)

}

 

Many thanks! 

1 answer

1 accepted

Hi Claire! 

Here is a simple example that works in my instance. This hides a Text Field based on what value is in a Single Select List: 

def textField = getFieldByName("TextFieldB")
def selectList = getFieldByName("SelectListA")

def selectListValue = selectList.getValue()

if (selectListValue == "AAA") {
textField.setHidden(true)
} else {
textField.setHidden(false)
}

This Behaviour is meant to go on the field you are basing the Behaviour on. In your example, you want to hide the Field A based on Field B. So the Behaviour should be put on Field B so that it is triggered every time the field is changed. 

Thank you Carmen, I will give this a go.

Hello @Carmen Creswell _Adaptavist_  

I have a checkbox field with  6 different options and would want to show the date field based on one of the options. In my question, I should have given the values as(A, B,C,D,E,F) instead of True, False and NA for better understanding. 

I want that-

1.If option D is ticked( D is an option of a checkbox field) then the Date field(Compliance Date) should be visible or else It should be hidden.

2. Even if D is ticket along with (A,B,C,E,F) the Compliance Date field should be visible and only hidden if D is not ticked.

 

Can you please advice on this?

Regards

Priyanka

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

78 views 0 4
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