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?