Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Scriptrunner fields hiding/showing based on another field value

I have problem with showing/hiding fields based on value chosen in previous field.
I found similar questions on this forum, but every solution that I tried failed. Perhaps its problem with Jira Service Desk version? We're using version 4.6.0 . 
We want to have field 'Vrsta poizvedbe' with few options. When option 'Duplikat is chosen' by costumer on portal field 'Datum predvidenega vračila' is shown. 
Otherwise is hidden. Its like cascadingValues is not 'Duplikat'. Is there a way to see what is in this field than?
Please help.

Annotation 2020-05-29 115222.pngAnnotation 2020-05-29 132335.png

1 answer

1 accepted

1 vote
Answer accepted

You have to put the serer-side script on the trigger field, not the target field.

So in this case, add the script to 'Vrsta poizvedbe'

def valuesToCauseHiding = ['Duplikat']
def fieldsToHide = ['customfield_12629']
def triggerField = getFieldById(getFieldChange())

def triggerValue = triggerField.value
def fieldToHide = getFieldById(fieldId)

fieldToHide.setHidden(triggerValue in valueToCauseHiding)

Thank you Peter

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

219 views 1 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