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

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

141 views 16 7
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