This video (Behaviours demo: Conditionally show/hide custom field with ScriptRunner for Jira Cloud) is what I need to do except that the field I am using is a multi select rather than a singe select field. Can this still be done?
https://www.youtube.com/watch?v=-Jt9BIlGcq4
Thanks
Jenifer
To answer your question, yes, this is doable.
Below is a sample working code for your reference:-
const changedField = getChangeField()
const multiSelect = getFieldById("customfield_10045")
const textField = getFieldById("customfield_10109")
textField.setVisible(true)
const multipleSelect = getFieldById("customfield_10045")
const myJSON = JSON.stringify(changedField.getValue())
if (myJSON.includes('Apple') ) {
textField.setVisible(false)
}
Please note that the sample code above is not 100% exact to your environment. Hence, you will need to make the required modifications.
Below are the screenshots of the Behaviour configuration:-
So, in this example, when the option Apples is selected from the Multi-Select List, the Multi-Line text field will be hidden.
Below are a couple of test screenshots for your reference:-
1. First, I try to create a new issue. When the issue dialog appears, the Text Field(Multi field) is visible by default.
2. Next, when I select the option Apple from the Multi-Select List, the Text Field (Multi Line) is hidden as expected, as shown in the screenshot below:-
I hope this helps to solve your question. :-)
Thank you and Kind regards,
Ram
Has your question been answered?
If yes, please accept the answer provided.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Ram, I missed the email. This is very helpful!
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.