Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,362,490
Community Members
 
Community Events
168
Community Groups

Script Runner Behaviours-10 different field pop-ups

Hello- I have a custom checkbox field in JIRA with a list of about thirty applications that a user may require.  For ten of these, the user's manager must also fill out the type of access required.  I created a behavior that unhides an additional field if any (or all) of these ten apps are checked off.  It works perfectly except for one problem:  If I select any one of the ten apps, then DESELECT it, the additional field DOES NOT get hidden again.  Can somebody tell me what I am missing?

Thank you, in advance.

-Ben

 

My Initializer:

def hiddenField01 = getFieldByName('Access-CAMRA')
def hiddenField02 = getFieldByName('Access-CAMRA Hub')
def hiddenField03 = getFieldByName('Access-DnD')
def hiddenField04 = getFieldByName('Access-GP')
def hiddenField05 = getFieldByName('Access-Nexus')
def hiddenField06 = getFieldByName('Access-North Shore')
def hiddenField07 = getFieldByName('Access-Piculet')
def hiddenField08 = getFieldByName('Access-Recon')
def hiddenField09 = getFieldByName('Access-Dashboard')
def hiddenField10 = getFieldByName('Access-XBasis')
hiddenField01.setHidden(true)
hiddenField02.setHidden(true)
hiddenField01.setHidden(true)
hiddenField02.setHidden(true)
hiddenField03.setHidden(true)
hiddenField04.setHidden(true)
hiddenField05.setHidden(true)
hiddenField06.setHidden(true)
hiddenField07.setHidden(true)
hiddenField08.setHidden(true)
hiddenField09.setHidden(true)
hiddenField10.setHidden(true)

 

...And my Fields:

def CAMRAField = getFieldByName("Access-CAMRA")
def CAMRAchangedField = getFieldById(getFieldChanged())
def selectedOption1 = CAMRAchangedField.getValue() as String
def isCAMRASelected = selectedOption1.contains("CAMRA")
CAMRAField.setHidden(! isCAMRASelected)

def CAMRAHubField = getFieldByName("Access-CAMRA Hub")
def CAMRAHubchangedField = getFieldById(getFieldChanged())
def selectedOption2 = CAMRAHubchangedField.getValue() as String
def isCAMRAHubSelected = selectedOption2.contains("CAMRA Hub")
CAMRAHubField.setHidden(! isCAMRAHubSelected)

def DnDField = getFieldByName("Access-DnD")
def DnDchangedField = getFieldById(getFieldChanged())
def selectedOption3 = DnDchangedField.getValue() as String
def isDnDSelected = selectedOption3.contains("DnD")
DnDField.setHidden(! isDnDSelected)

def DGPField = getFieldByName("Access-GP")
def DGPchangedField = getFieldById(getFieldChanged())
def selectedOption4 = DGPchangedField.getValue() as String
def isDGPSelected = selectedOption4.contains("Dynamics GP")
DGPField.setHidden(! isDGPSelected)

def NexusField = getFieldByName("Access-Nexus")
def NexuschangedField = getFieldById(getFieldChanged())
def selectedOption5 = NexuschangedField.getValue() as String
def isNexusSelected = selectedOption5.contains("Nexus")
NexusField.setHidden(! isNexusSelected)

def NSField = getFieldByName("Access-North Shore")
def NSchangedField = getFieldById(getFieldChanged())
def selectedOption6 = NSchangedField.getValue() as String
def isNSSelected = selectedOption6.contains("North Shore Asset Management System")
NSField.setHidden(! isNSSelected)

def PiculetField = getFieldByName("Access-Piculet")
def PiculetchangedField = getFieldById(getFieldChanged())
def selectedOption7 = PiculetchangedField.getValue() as String
def isPiculetSelected = selectedOption7.contains("Piculet")
PiculetField.setHidden(! isPiculetSelected)

def ReconField = getFieldByName("Access-Recon")
def ReconchangedField = getFieldById(getFieldChanged())
def selectedOption8 = ReconchangedField.getValue() as String
def isReconSelected = selectedOption8.contains("Recon")
ReconField.setHidden(! isReconSelected)

def WDField = getFieldByName("Access-Dashboard")
def WDchangedField = getFieldById(getFieldChanged())
def selectedOption9 = ReconchangedField.getValue() as String
def isWDSelected = selectedOption9.contains("Web Dashboard")
WDField.setHidden(! isWDSelected)

def XBField = getFieldByName("Access-XBasis")
def XBchangedField = getFieldById(getFieldChanged())
def selectedOption10 = ReconchangedField.getValue() as String
def isXBSelected = selectedOption10.contains("XBasis")
XBField.setHidden(! isXBSelected)

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events