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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Adaptavist ScriptRunner Behaviour - Hide field based on value of other field

Deleted user Aug 10, 2020

I am trying to execute a simple behaviour using Adaptavist ScriptRunner.  On a workflow transition screen, I have 2 fields:

  • customfield_10907 is a select list (single) field
  • customfield_28501 is a radio button field

If the user selects "Training" in customfield_10907, then customfield_28501 should appear.

If the user selects any other value, then customfield_28501 should be hidden.


Here is my server-side script:

def CategoryField = getFieldById("customfield_10907")
def moreTrainingField = getFieldById("customfield_28501")

if (CategoryField.getValue() == "Training") {
} else {

The behaviour is not not working.  customfield_28501 appears on the transition screen regardless of the selection in customfield_10907

Any suggestions on how to fix this so it will work?

1 answer

1 accepted


I checked your code, modified a little bit, and it has to be work, I tested. If you set the proper project and issue type(s), and add the Category select field (10907) to the Fields, add the script like a Server-side script it has to be work.
If the fields appear together only in that transition screen you don't have to be do anything else. But is you use them together you should use an action, to avoid unexpected events.

* Atlassian Community answer
* <a href="" target="_blank">Adaptavist ScriptRunner Behaviour - Hide field based on value of other field</a>
* @author Tamás Baglyas -
* @version 1.0
* @since 2020-08-11
if (getActionName().equals("Transition name where you want to use these behaviours.")) {
boolean hidden = !(getFieldById("customfield_10907")?.getValue()?.toString()?.equals("Training"));


Deleted user Aug 11, 2020

Hi @Tamas Baglyas .  Thanks for the reply.  It is very close but doing the opposite of what I need.   Currently, if the users selects Training, custom field 28501 is hidden.  I want custom field 28501 visible only if user selects Training.  Here is the script:

if (getActionName().equals("Validate Requirement")) {
boolean visible = getFieldById("customfield_10907")?.getValue()?.toString()?.equals("Training");

Hi @[deleted] ,


Thanks, I modified my script based on your clarification. I think it is closer now.




Deleted user Aug 11, 2020

@Tamas Baglyasthanks again.  It is working as expected!

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.
Nov 17, 2023 • edited

@Tamas Baglyas Hi!

I was looking for a solution and found your answer. Thank you! This works great!
I add this is code in BEHAVIOUR . It's worked !

Be sure to check the context. The code should be in the “field” tab, and not in the “Initialiser”"

boolean hidden = !(getFieldById("customfield_24511")?.getValue()?.toString()?.equals("Yes"))


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events