Very useful example to get the values of a cascading customfield using Groovy in Jira.

import com.atlassian.jira.issue.customfields.view.CustomFieldParams
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.customfields.view.CustomFieldParams
import com.atlassian.jira.issue.customfields.impl.CascadingSelectCFType
import org.apache.log4j.Category

def field = customFieldMananger.getCustomFieldObjectByName("CASCADING_CUSTOMFIELD_NAME")
Object cfVal = issue.getCustomFieldValue(field)

HashMap<String, Option> hashMapEntries = (HashMap<String, Option>) cfVal
if (hashMapEntries != null) {
Option parent = hashMapEntries.get(CascadingSelectCFType.PARENT_KEY)
Option child = hashMapEntries.get(CascadingSelectCFType.CHILD_KEY)
first = parent.toString()
second = child.toString()
log.debug("Cascading values selected: $first - $second")

Posted by:.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s