The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to control the display fields based on multiple selection drop-down values?

e-Dongyang.Liu
December 18, 2024

How to use Scriptrunner to control the display of fields A and B based on Y's multiple selection of dropdown values A001 and B001?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
e-Dongyang.Liu
December 19, 2024
//Obtain field IDs for X field (multiple choice values: A, B, C), A field, B field, and C field
def fieldX = getFieldById("customfield_15004")
def fieldA = getFieldById("customfield_18201")
def fieldB = getFieldById("customfield_18202")
def fieldC = getFieldById("customfield_18203")
// Get the value of field X
def valuesX = fieldX.getValue() as List

// Control the display or hiding of fields A, B, and C based on the value of field X
if (valuesX.contains("A")) {
    fieldA.setHidden(false)
} else {
    fieldA.setHidden(true)
}

if (valuesX.contains("B")) {
    fieldB.setHidden(false)
} else {
    fieldB.setHidden(true)
}

if (valuesX.contains("C")) {
    fieldC.setHidden(false)
} else {
    fieldC.setHidden(true)
}
DEPLOYMENT TYPE
SERVER
VERSION
8.22.6
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events