JIRA SERVER

This article shows how to sync the user, who 'Exalates' issues on the Source side to an issue reporter field on the Destination side.

With the help of JIRA Server API using authentication context, the Exalate app can get currently logged in user and sync it to the reporter field on the Destination side.

Source side

Outgoing sync

// SENDING THE USER THAT EXECUTED THE CURRENT ACTION THAT TRIGGERED SYNC
replica.customKeys."executor" = nodeHelper.getUser(
  com.atlassian.jira.component.ComponentAccessor
    .getJiraAuthenticationContext()
    .getLoggedInUser()?.key
)
// END: SENDING THE USER THAT EXECUTED THE CURRENT ACTION THAT TRIGGERED SYNC



Destination side

Incoming sync

Set a local issue reporter to the user, who 'exalated' the issue on the source side. 

With the help of getUserByEmail nodeHelper method, find a user by email and set it as a reporter of the synced issue. 

// SETTING THE REPORTER TO BE THE SAME AS THE SOURCE ACTION EXECUTOR
issue.reporter = nodeHelper.getUserByEmail(replica.customKeys."executor"?.email)
// END: SETTING THE REPORTER TO BE THE SAME AS THE SOURCE ACTION EXECUTOR

See Also