Hello Community,
I need to show a field on the basis of another. If click on one of the options on checkbox field then the other field(date field) should be visible, if i have not
selected that particular check box then it should be hidden. I am using JIRA server version 8.5.0. How can i achieve this using script runner?
Regards
Priyanka Khare
how can we do this kind of behavior without a script runner?
You can create a Behaviour in Scriptrunner that will show or hide the field based on the value of the checkbox. Take a look at https://scriptrunner.adaptavist.com/latest/jira/tutorials/behaviours-tutorial.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you've got ScriptRunner installed, then you can use the 'Behaviors' function to do this pretty easily. Adaptavist has an example in their library on how to do this, but their example is maybe a little more complicated than it needs to be. Here's my example, show\requiring two custom fields if the "Yes" option in the third field is selected. You may need to modify this some with a checkbox field, but this should get you pretty close.
// Get the fields you need
def triggerField = getFieldByName("Custom Checkbox Field")
def showField1 = getFieldByName("Custom Field 1")
def showField2 = getFieldByName("Custom Field 2")
// Evaluate the selected value; in this case, does it equal the string "Yes"
if(triggerField.value == "Yes"){
showField1.setHidden(false)
showField1.setRequired(true)
showField2.setHidden(false)
showField2.setRequired(true)
}
else{
showField1.setHidden(true);
showField1.setRequired(false);
showField2.setHidden(true);
showField2.setRequired(false);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Haddon Fisher
I need to be able to view the date field even if i select Yes and Na in my checkbox field.
For eg:
I have a checkbox field - Yes, No, NA and i want to-
1.show Date field when Yes is selected(even when yes is selected along with NA)
2. hide the date field if Yes is not selected at all.
Regards
Priyanka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Priyanka khare , in that case you would just need to add a second 'if' clause to show the field if "NA" is selected.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
An old case here but I am trying exactly the same for the create and edit screen.
My case: If in the Checkboxes field "Features" the value "Head-to-Head Test" is selected the Single Issue Picker field "DIGI Ticket" should get visible.
When using the code the "DIGI Ticket" is hidden but it does not get visible when selecting "Head-to-Head Test". Any idea what I'm missing?
Thanks!
Christina
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.