Forums

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

How to use Behaviors to require a custom field based on Resolution selected

Chris Horton - CDHS
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 6, 2020

I am trying to set a custom field as required when the selected Resolution equals "Functions as Designed" and have the custom field hidden if that Resolution is not selected.

 

Here is what I'm trying:

The result is that the custom field remains hidden no matter what Resolution is selected.

 

2020-06-06 11_26_59-Behaviours - CBMS Jira.png

1 answer

1 accepted

1 vote
Answer accepted
Hana Kučerová
Community Champion
June 6, 2020

Hi @Chris Horton - CDHS ,

please, try this:

import com.atlassian.jira.issue.resolution.Resolution

def resolutionField = getFieldById(getFieldChanged())
def fadField = getFieldById("customfield_12771")

def resolution = resolutionField.getValue() as Resolution

if (resolution.name == "Functions as Designed") {
    fadField.setHidden(false)
    fadField.setRequired(true)
} else {
    fadField.setHidden(true)
    fadField.setRequired(false)
}
Chris Horton - CDHS
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 6, 2020

that works. Thank you!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events