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,366,843
Community Members
 
Community Events
168
Community Groups

Check my code-----script using behavior

Hi,

i want to set a custom field as view or hidden on the screen based on option selected from the cascading style custom field.

i wrote a script on behavior.but it not effected.can any one suggest me plz.

On Initializer....,

def act1 = getFieldById("customfield_14357")
act1.setHidden(true)

def act2 = getFieldById("customfield_14358")
act2.setHidden(true)

def act3 = getFieldById("customfield_14359")
act3.setHidden(true)

def act4 = getFieldById("customfield_14360")
act4.setHidden(true)

 

On Field of server side script...,


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.customfields.view.NullCustomFieldParams

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
Issue issue
//MutableIssue issue = ComponentAccessor.getIssueManager().getIssueObject('SOA-67')
CustomField state = customFieldManager.getCustomFieldObject("customfield_14201")
Map cfVal = issue.getCustomFieldValue(state) as Map
//List value
if (cfVal) {
String first = cfVal.get(null)
String second = cfVal.get("1")
//value = cfVal.values() as List

def act1 = getFieldById("customfield_14357")
def act2 = getFieldById("customfield_14358")
def act3 = getFieldById("customfield_14359")
def act4 = getFieldById("customfield_14360")


if (second == 'ACT') {
act1.setHidden(false)
act1.setRequired(true)

act2.setHidden(false)
act2.setRequired(true)

act3.setHidden(false)
act3.setRequired(true)

act4.setHidden(false)
act4.setRequired(true)

}
}

0 comments

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events