How to remove null in Cascading select?

This is the code im using to get the value in CustomField:

$issue.getCustomFieldValue("customfield_10070") or


it gets the CustomField value but it has a {null=} or {null=" ", 1=" "}.


{null=Cloud9, 1=Web}

Im using velocity, this code is for notification template.

how to remove the {null=" ", 1=" "}?

The CustomField is a Cascading Select.



7 answers

Hey all,

i've build a separate field-template for cascading select fields. Just replace the XXXXX with your customfield-ID and in your mail the content will be displayed like "ParentValue - ChildValue".


	<th>$stringUtils.leftPad($issue.getCustomField("customfield_XXXXX").name, $padSize):</th>
		#set ($customfield=$issue.getCustomFieldValue("customfield_XXXXX"))
		#set ($start_par=$stringUtils.indexOf($customfield.toString(), '='))
		#set ($start_par=$start_par+1)
		#set ($start_child=$stringUtils.lastIndexOf($customfield.toString(), '='))
		#set ($start_child=$start_child+1)
		#set ($ParentValue=$stringUtils.substring($customfield.toString(), $start_par, $stringUtils.indexOf($customfield.toString(), ',')))
		#set ($ChildValue=$stringUtils.substring($customfield.toString(), $start_child, $stringUtils.lastIndexOf($customfield.toString(), '}')))
		$ParentValue - $ChildValue


This works atleast for 6.3.8.

I met an Atlassian person at last year's conference, and here is what he told me:

#set( $cfValue = $issue.getCustomFieldValue("customfield_10000"))
$cfValue.getFirstValueForNullKey() - $cfValue.getFirstValueForKey("1")
(replace customfield_10000 with an id for your custom field in both spots!).
This worked in JIRA 4.5, but it's not working in 5.2 right now.


Is there a workaround for the 5.1 version? Indeed, the function "getFirstValueForKey("1")" returns empty.



I found a temporary solution (for example in a templates/email/html/includes/fields/myCustomField.vm):

#set ($value = $issue.getCustomFieldValue("customfield_10000").toString())
#if ($stringUtils.isNotBlank($value))
##Example $value: {null=Foo, 1=Bar}
#set ($childValue=$stringUtils.chop($stringUtils.substringAfterLast($value,'=')))
#if ($stringUtils.isNotBlank($childValue))
<tr valign="top">
    <td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:${textSubtleColour};">My Field:</strong>
    <td style="color:${textColour};font-family:${textFontFamily};font-size:${textSize};padding:0 0 10px 0;width:100%;">
    ##display "My Field: Bar" only

Hi all, ive just used this to select the second string in a Cascading Select. with Version 6.0 of Jira

#set ($value = $issue.getCustomFieldValue("customfield_10000").toString())
#if ($stringUtils.isNotBlank($value))
#set ($childValue=$stringUtils.chop($stringUtils.substringAfterLast($value,'=')))
#if ($stringUtils.isNotBlank($childValue))

I have tried @Aaron Roddis code but I get the following error:

No such property: value for class: groovy.lang.Binding

Any ideas how to parse cascading select list without null?

<% out << issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObject("customfield_XXXXX")).values()*.value%>


Suggest an answer

Log in or Join to answer
Community showcase
Maarten Cautreels
Posted Thursday in Off-topic

Friday Fun: What's your favourite beer/drink

As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...

285 views 38 9
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot