cascaded list

Daniel Byrne June 11, 2014

So hear is our scenario:

We would like to connect our JIRA to TFS and sync the Work Items accross both platforms. We have set up the TFS4JIRA synchronizer. In order for our items to sync properly, we need to have a Region and Country field.

The problem is that our regions (North America, Asia, Europe, etc.) define the country list. The built in cascade list would work perfectly for us if we did not have to export that field out to our TFS server. The problem being that the cascade list appears to store both values of the lists (Region/Country) in the single field, while our requirement is that they are seperate.

Example:

Region (selected) -> North America --- Custom Field 1

Country (selected from North America) -> United States --- Custom Field 2

Is there anything out there that we can do? Or a script we could write?

Edit: a possible scenario that we though of is using the plugin ScriptRunner to creat two addtional custom fields and getting the values for those fields from the cascaded list. Any ideas on how to get the values selected from the cascaded list?

1 answer

1 accepted

0 votes
Answer accepted
Daniel Byrne June 12, 2014

Update: I went ahead and created a regular cascaded list named "Region/Country", where country list dependened on region.

I then used the plugin ScriptRunner's scripted custom fields. One was "Region" and the other was "Country", from there I wrote a groovy script to extract the data from our original custom field. Here is our script:

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager

//Get our field
def componentManager = ComponentManager.getInstance().getCustomFieldManager()
def cascadedList = componentManager.getCustomFieldObject( "customfield_10213" )
def cascadedValue = cascadedList.getValue( issue ) 

//Make sure we have a list
if ( cascadedList != null )
{
	//Get the region/country pair and tokenize the string
	pair = cascadedValue.toString()
	def tokens = pair.tokenize( ":" )
	
    //Always will be 3rd index (verify?)
    country = tokens.getAt( 3 )
	country = country.minus( "]" )
	return country
        
        
}
else
{
	return "Error sending country information..."
}

It was easy to change it for the region case. I am happy with this solution.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events