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

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
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.  ...

483 views 16 17
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