Hi,
I have three custom fields (A, B, C). I want to display on the form/initialize fields B and C only when field A has a value. Field A is a Select List (single choice). I have the Scriptrunner plugin so i can use either behavior plugin or scripted fields. I found many solutions in the community with similar codes but none of them is working properly for my project.
Where do i have to put the code and what code shall i use to make the fields B and C hidden from the beginning (before creating the issue)?
Hi Stefani,
You should be able to do this fairly easily using a behaviour.
def SelectListA = getFieldById(getFieldChanged()) // Field A
def TextFieldA = getFieldByName("TextFieldA") // Field B
TextFieldA.setHidden(true)
def TextFieldB = getFieldByName("TextFieldB") // Field C
TextFieldB.setHidden(true)
if (SelectListA.getValue()) {
TextFieldA.setHidden(false)
TextFieldB.setHidden(false)
}
This script will hide Field B and Field C whenever someone tries to create an issue. If they select a value for Field A, both fields will become visible.
Fields hidden from the beginning:
Fields shown after SelectListA has a value:
I've tried it but it doesn't work, Am i missing something? I want to hide automatically these fields on the form. I am working on a Service Desk issue's form. When a user clicks on the 'Report a problem', the form that is shown has to have the fields B and C hidden and display them only when the user choose any value from the field A. Do i have to enable Initialiser Function or Validator Plugin?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Behaviours do not work well with JIRA Service Desk, unfortunately.They are not compatible with each other. https://productsupport.adaptavist.com/browse/SRJIRA-728
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Qi Jiang what does exactly work? Is there any other way/solution for this to be done in Service Desk?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.