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

Scriptrunner Behaviour to require and unhide a field based on value of another field



I'm trying to implement a Behavior using Scriptrunner. I have a field for Severity that is required on a specific Service Desk request. Desired behavior is that if a user selects "High" value for Severity, a field (previously hidden) will appear for Emergency Justification, and this field will be required. 

I modeled my code after the solution I found on this question, but it isn't working. Here's the code:


import com.atlassian.jira.issue.fields.CustomField

def CustomField = getFieldById("customfield_10408")
def Custom2Field = getFieldById("customfield_10622")

if (CustomField.getValue() == "High (Emergency)") {

else {



It appears to work partially, because customfield_10622 is set in the screen as not hidden, and it is hidden to the user when initially entering the Request. But it doesn't appear when the defined value is selected. What am I missing?

*using Jira 8.1 + Scriptrunner


3 answers

2 accepted

1 vote
Answer accepted

Hi @Bethany_Glismann 


Can you paste a screenshot of behaviours configuration?

In my cases when behaviours didn't work the reason was in wrong place where I put script.




Hi Seba,

Thanks for the reply. You may be right - the screenshots I used from the how-tos were for an older version and didn't look like my version, so maybe I put it in the wrong place. See screenshot.



0 votes
Answer accepted

Sorry @Sebastian Krzewiński I tried to respond yesterday and the community seemed to be down. Adaptavist support got back to me and indeed, I was using the wrong area for my script (entering it in the Initializer area, not the server-side script area). All good now!

0 votes
Antoine Berry Community Leader Jun 11, 2019

Hi @Bethany_Glismann ,

What do the logs say ? You should log the value to make sure it is consistent to the String you are testing against :

log.error("CustomField value : " + CustomField.getValue())


Suggest an answer

Log in or Sign up to answer
Community showcase
Asked in Jira Service Desk

Calling all Mindville Insight users, we need your help! (there might be swag involved)

Hello Insight users,  As part of our (Mindville's) acquisition by Atlassian, our training team is looking to build some new Insight training materials and we want to hear from you!  ...

276 views 4 6
View question

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