Present / Hide fields based on value of another field using "Behaviours"

Darren Fairweather December 3, 2020

Hi Community,

I am pulling my har out with this one... undoubtedly due to my lack of coding knowledge!

I have a field "RAID Type". I want different fields to be presented and hidden based on what is selected.

For example if "Issue" is selected present these fields and hide these ones.

The trouble begins when i create multiple behaviours and serverside scripts.

For example i create another behaviour to say when "Risk" is selected the present these fields and hide these ones.

It seems to get confused and the first behaviour set seems to malfunction.

Should this behaviour all be in one script and if so how do i do it?

Below is an example of the code for a single behaviour that works fine. Its just when i start adding multiple behaviours that the malfunctions start.

Please please could anyone help?

Thanks in advance.

 

 

def EscalationLevelField = getFieldByName("Escalation Level")

def ResponsePlanField = getFieldByName("Response Plan")

def ImpactScoreField = getFieldByName("Impact Score")

def ResolutionDateField = getFieldByName("Resolution Date")

def MitigationPlanField = getFieldByName("Mitigation Plan")

def TargetResolutionDateField = getFieldByName("Target Resolution Date")

def DecisionRequiredByField = getFieldByName("Decision Required By")

def ProbabilityField = getFieldByName("Probability")


def RAIDtypeField = getFieldById(getFieldChanged())

 

def selectedOption = RAIDtypeField.getValue() as String

def isOtherSelected = selectedOption == "Issue"

 

TargetResolutionDateField.setHidden(! isOtherSelected)

TargetResolutionDateField.setRequired(isOtherSelected)

ResponsePlanField.setHidden(! isOtherSelected)

ResponsePlanField.setRequired(isOtherSelected)

EscalationLevelField.setHidden(! isOtherSelected)

EscalationLevelField.setRequired(isOtherSelected)

ResolutionDateField.setHidden(! isOtherSelected)

ResolutionDateField.setHidden(isOtherSelected)

ImpactScoreField.setHidden(! isOtherSelected)

ImpactScoreField.setRequired(isOtherSelected)

MitigationPlanField.setHidden(! isOtherSelected)

MitigationPlanField.setRequired(isOtherSelected)

DecisionRequiredByField.setHidden(! isOtherSelected)

DecisionRequiredByField.setRequired(isOtherSelected)

ProbabilityField.setHidden(! isOtherSelected)

ProbabilityField.setHidden(isOtherSelected)

 

1 answer

1 accepted

0 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 7, 2020

Hello @Darren Fairweather 

Welcome to the community.

When you create your behaviors is each set of rules specific to an issue type? Are you creating a mapping for the behaviour to apply it to specific project(s) and issuetype(s)?

How does the "malfunction" manifest? What steps are you executing before the malfunction happens?

Suggest an answer

Log in or Sign up to answer