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

log.setLevel(org.apache.log4j.Level.DEBUG)
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")
}

Advertisements
Posted by:.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

w

Connecting to %s