How to sync between components on Server side and a custom selection field in Cloud?

Originally asked by Hung Nguyen on 26 February 2021 (original question)


Hi,

We had connection between server and cloud instances, where we want to sync components in the server instance to a custom selection field, named ‘Remote Components’ in Cloud.

And from the Cloud, if user changes ‘Remote Components’, it got sync to the server side so that component is set to the same name and assignee set to component lead

My first try was:

  1. In the Cloud side, use this rule for Incoming section
/ Incoming rule for the Cloud instance
def remoteComponentName = replica.components?.first().name
issue.customFields."Remote Components".value = 
		nodeHelper.getOption(issue, "Remote Components", remoteComponentName)

2. In the Server side, use this rule

issue.components = [
	nodeHelper.getComponent(replica.customFields."Remote Components".value,
	nodeHelper.getProject(issue.projectKey ?: issue.project.key)
]

But it didn’t seem to work.

Any idea ?