You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hello All,
I am using a custom field (single select) in our jira which contains the list of our plaforms.
Now I would like to have a second custom field (multi select) with the same list for another usage.
I am trying to figure out how I could keep both option list synced.
Any idea?
Thanks in advance.
Thank you very much for your answer.
So I managed to write this groovy script which only takes care of options added in field Cffrom and recopies it to field Cfto in case it is not present. Here is the script:
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.context.IssueContext
// SETTINGS
final def CffromName = "myfieldfrom"
final def CftoName = "myfieldto"
// END SETTINGS
def cfm = ComponentAccessor.getCustomFieldManager()
def om = ComponentAccessor.getOptionsManager()
def cffrom = cfm.getCustomFieldObjectsByName(CffromName).find()
assert cffrom : "Could not find custom field with name $CffromName"
def cfto = cfm.getCustomFieldObjectsByName(CftoName).find()
assert cfto : "Could not find custom field with name $CftoName"
def ffCfg = cffrom.getRelevantConfig(IssueContext.GLOBAL)
def localOptionsfrom = om.getOptions(ffCfg)
def ftCfg = cfto.getRelevantConfig(IssueContext.GLOBAL)
def localOptionsto = om.getOptions(ftCfg)
for (fromOptionValue in localOptionsfrom)
{
if (!localOptionsto.any { o -> o.value == fromOptionValue.value }) {
om.createOption(ftCfg, null, null, fromOptionValue.value)
}
}
Now the only remaining question is what is the best tool to execute it ? Is there an event that could trigger it, or is Custom scheduled job the best solution from your point of view?