Forums

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

Dynamic display Component/s field failed

Kyle Li
Contributor
February 20, 2020

We use below script to dynamic display Component/s, but it failed, however it works for custom field APP/CI Name.

Anyone knows what's script to dynamic display system field ?

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours

def IT_deparment = getFieldById(getFieldChanged())
def component_s = getFieldByName("Component/s")
def app_ci_Name = getFieldByName("APP/CI Name")
//def description = getFieldByName("Description")

def IT_deparment_value = IT_deparment?.value as List

//description.setFormValue("aaaaaaa")

if (IT_deparment_value in [["CN","IT Development-DST"],
["CN","IT Development-B2C"],
["CN","IT Development-SOM"],
["CN","IT Development-IT2IT"]]){
component_s.setHidden(true)
component_s.setRequired(false)
app_ci_Name.setHidden(false)
app_ci_Name.setRequired(true)

}
else {
app_ci_Name.setHidden(true)
app_ci_Name.setRequired(false)
component_s.setHidden(false)
component_s.setRequired(true)
}

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events