Sync between user picker field and reporter field

Originally asked by Bernd Freitag on 25 January 2022 (original question)


Dear Exalate Support,

I want to sync the user in a user picker custom field to the reporter field in another Jira project. So the use case looks like:

  • I set the user picker customfield in issue of project A
  • sync process will triggered and set the reporter project B with the user of the user picker field in issue of project A

this should work the other way around as well:

  • setting the user picker field in issue of project B
  • sync should set the reporter with the value of user picker field of project B in issue of project A

I am using the the scripted connection. Can you tell me how the outgoing and incoming configuration for my use case should looks like?

Thanks for support!

Regards

Bernd


Comments:

Ariel Aguilar commented on 31 January 2022

Hi there,

The following example applies for Group Picker(single group) synchronization.

Outgoing sync:

if (issue.customFields."Remote Reporter"?.value instanceof Iterable) {
    issue.customFields."Remote Reporter".value = issue.customFields."Remote Reporte".value.find()
}
replica.customFields."Remote Reporter" = issue.customFields."Remote Reporter"

Incoming sync:

def remoteReporter = replica.customFields."Remote Reporter"?.value?.name?.asString
issue.reporter = nodeHelper.getUserByEmail(remoteReporter)

Let me know if that helps,

Kind regards,

Ariel