Hello,
I have a requirement to show/hide a tab on the basis of an option selected(single select) on the other tab. How can I achieve this?
Regards,
Priyanka
For your requirement, you can use ScriptRunner's Behaviour.
You will need to configure a Server-Side Behaviour for the Single Select List.
Once you have done so, you will need to include some conditions in the Server-Side Behaviour.
Below is a working sample Server-Side Behaviour code for your reference:-
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours behaviours
def list1 = getFieldById(fieldChanged)
def list1Value = list1.value.toString()
showTab(1)
if(list1Value == 'Hide') {
hideTab(1)
}
Please note, this sample code is not 100% exact to your environment. Hence, you will need to make the required modifications.
What this code does is that when the Hide option is selected from the list, the second tab, i.e. Tab 2, will be hidden. Else, if any other option is selected, the second tab is made visible once again.
Below is a print screen of the Behaviour configuration for your reference:-
Also, I am including a few test screens for your reference:-
If the option selected from the List 1 field is either None or Show, both the tabs will be visible as shown in the first two print screens below:-
If the option selected from List 1 is Hide, the second tab will be hidden as shown in the image below:-
I hope this helps to solve your question. :)
Thank you and Kind Regards,
Ram
Hello @Ram Kumar Aravindakshan _Adaptavist_ ,
I appreciate the detailed answer to my question. Many thanks to you. It worked.
Regards,
Priyanka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.