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
Accepted answer

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
Community showcase
Published yesterday in Feedback & Announcements

How do you analyze GC logs, thread dumps and head dumps?

Hi awesome community!  In this article, I would like to describe the one of the toolset (service) for the analyze some problems on different Java-based instances, of course, as Atlassian admini...

95 views 0 7
Read article

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