Hi,
I have a multi select field (Customer Impacts) that has 3 options- Asset Management, Branch Banker Support and Business Banking. I also have 3 number type fields - CI_AM, CI_BBS, CI_BB. (one for each options)
The requirement is, if I select any of the 3 options from the from the Multi select field, the corresponding number field should show. Example, if I pic Asset Management, CI_AM should show. If I pick both Asset Management and Business Banking both CI_AM and CI_BB should show and so on...
I tried several approach to achieve this but no luck. Any help is appreciated.
Hi @Joel Batac
For your requirement, you should try something like this:-
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours behaviours
def sampleMultiSelect = getFieldById(fieldChanged)
def sampleMultiSelectValue = sampleMultiSelect.value.toString()
def sampleNumber1 = getFieldByName('Sample Number 1')
def sampleNumber2 = getFieldByName('Sample Number 2')
def sampleNumber3 = getFieldByName('Sample Number 3')
sampleNumber1.hidden = true
sampleNumber2.hidden = true
sampleNumber3.hidden = true
if (sampleMultiSelectValue == '[Behaviour, Listener, Fragment]') {
sampleNumber1.hidden = false
sampleNumber2.hidden = false
sampleNumber3.hidden = false
} else if (sampleMultiSelectValue == '[Behaviour, Listener]') {
sampleNumber1.hidden = false
sampleNumber2.hidden = false
} else if (sampleMultiSelectValue == '[Behaviour, Fragment]') {
sampleNumber1.hidden = false
sampleNumber3.hidden = false
} else if (sampleMultiSelectValue == '[Listener, Fragment]') {
sampleNumber2.hidden = false
sampleNumber3.hidden = false
} else if (sampleMultiSelectValue == '[Behaviour]') {
sampleNumber1.hidden = false
} else if (sampleMultiSelectValue == '[Listener]') {
sampleNumber2.hidden = false
} else if (sampleMultiSelectValue == '[Fragment]') {
sampleNumber3.hidden = false
}
Please note that the sample code provided above is not 100% exact to your environment. Hence, you will need to make the required modifications.
Below are a few screenshots for your reference:-
1) When only the Behaviour option is selected from the Multi-Select List, only the Sample Number 1 field is displayed.
2) When only the Listener option is selected from the Multi-Select List, only the Sample Number 2 field is displayed.
3) When only the Fragment option is selected from the Multi-Select List, only the Sample Number 3 field is displayed.
4) When both the Behaviour and Listener options are selected from the Multi-Select List, both the Sample Number 1 and Sample Number 2 fields are displayed.
5) When both the Behaviour and Fragment options are selected from the Multi-Select List, both the Sample Number 1 and Sample Number 3 fields are displayed.
6) When both the Listener and Fragment options are selected from the Multi-Select List, both the Sample Number 2 and Sample Number 3 fields are displayed.
7) When all options are selected from the Multi-Select List, all the Number fields are displayed.
I hope this helps to answer your question. :)
Thank you and Kind regards,
Ram
Thanks Ram. Is it possible to do a loop? In reality the multi select field contains 27 options ( i just gave a 3 for simplicity)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Joel Batac
There is no simple way for this.
Making a loop will not work as expected and will cause errors.
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.
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.