Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Community showcase
Published in Jira

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their  Jira Cloud instance.  ...

776 views 17 21
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you