The Exalate team will be on holiday for the coming days - returning Jan 4
Enjoy & stay safe
1
0
-1
1 answer
- 10-1
This configuration can be achieved the following way, it contains a method to check against the value on the remote end and ignore the casing in order to avoid duplicate label creation.
(the text field is "SimpleTestField" and the dropdown filed in the below example is "labelDrop"):
Jira Cloud Outgoing:
replica.customFields."SimpleTestField" = issue.customFields."SimpleTestField"
Jira On-Prem Incoming
// SETTINGS final def nygSelectListCfName = "labelDrop" // END SETTINGS import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.context.IssueContextImpl def cfm = ComponentAccessor.getCustomFieldManager() def om = ComponentAccessor.getOptionsManager() def remoteOptionValue = replica.customFields."SimpleTestField"?.value as String def cf = cfm.getCustomFieldObjectsByName(nygSelectListCfName).find()//Long projectId, String issueTypeId def project = issue.project?: nodeHelper.getProject(issue.projectKey) def type = issue.type?: nodeHelper.getIssueType(issue.typeName, project.key) def ctx = new IssueContextImpl(project.id as long, type.id) def fCfg = cf.getRelevantConfig(ctx) if (fCfg == null) { debug.error("couldn't find relevant config for project ${issue.project.id} + ${issue.type.id} for custom field use ${cf.name}") } def localOptions = om.getOptions(fCfg) def localOption = localOptions.find( {allowedOption -> remoteOptionValue.equalsIgnoreCase(allowedOption.getValue())} ) if (!localOption){ if (!localOptions.any { o -> o.value == remoteOptionValue }) { //FieldConfig fieldConfig, Long parentOptionId, Long sequence, String value om.createOption(fCfg, null, 0L, remoteOptionValue) } } else { issue.customFields."labelDrop".value = localOption.getValue() }
Add your comment...
Having a text field I want it to sync to a single select field on the remote end, therefore if the option on the single select field doesn't exist, to have it created.