Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Change ID on a Elements Connect field

Dear Community

I am currently facing a problem I need to solve:

Quite a while ago, I created an Elements connect field that lets the user choose one or multiple teams (it is used for Features, to indicate, which team is working on it). Young and unexperienced as I was back then, I just used "select NAME from table_containing_teams" 

This worked quite fine, until the first team changed its name. As the team name was also the ID stored in jiras DB, when the name of a team changes on the source DB, all the values that were selected in jira issues will be lost.

The teams on the source DB do have an ID row, wich contains a unique ID that does not change, when the team name changes. Therefore it would be way better to use the ID from the source DB as ID in Elements Connect.

Meanwhile, there are thousands of issues using the mentionned field. If I would just adapt the SQL query for the Elements Connect field and use the object ID as ID in jira, all of the values on those tickets will be lost. However, I will have to change this configuration to avoid future administrative overhead.

Does anyone have an Idea, how this issue can be fixed, without using any data or having to manually edit all the issues using the field in Question?

2 answers

Suggest an answer

Log in or Sign up to answer

I had similar case where I had to update 1000's of ticket. Maybe you can use this.

What I did was searched for the issues (yours could be project = PROJECTNAME and team = TeamName). Once you have the list of issues, you can do below. 

 

import com.atlassian.jira.component.ComponentAccessor
def pluginAccessor = ComponentAccessor.getPluginAccessor();
def plugin = pluginAccessor.getPlugin("com.valiantys.jira.plugins.SQLFeed");
def serviceClass = plugin.getClassLoader().loadClass("com.valiantys.nfeed.api.IFieldValueService");
 
def fieldValueService = ComponentAccessor.getOSGiComponentInstanceOfType(serviceClass);
 
def customFieldId = "customfield_29801"; //your EC field
def map = [
'PROJECTNAME-4103':'NEW_Team_Name', //EC Value to put
'PROJECTNAME-3529':'NEW_Team_Name',
'PROJECTNAME-4954':'NEW_Team_Name',
'PROJECTNAME-7132':'NEW_Team_Name',
'PROJECTNAME-4476':'NEW_Team_Name',
'PROJECTNAME-4103':'NEW_Team_Name',
'PROJECTNAME-4476':'NEW_Team_Name'
]
map.each { issueKey, connectKeyValue ->
fieldValueService.setFieldValue(issueKey, customFieldId, connectKeyValue);
}
0 votes
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 08, 2023

You should be able to write a short groovy script to go through all issues that have a value in your Elements Connect fields and replace the team name with the team id.

I have never used Elements Connect field, so I can't provide details about that.

TAGS
AUG Leaders

Atlassian Community Events