Setting the Current Authenticated User as a Target Issue Reporter in Exalate for Jira on-premise

    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, Exalate can get the currently logged in user and sync it to the reporter field on the Destination side.

    Source side

    Outgoing sync

    1 // SENDING THE USER THAT EXECUTED THE CURRENT ACTION THAT TRIGGERED SYNC
    2 replica.customKeys."executor" = nodeHelper.getUser(
    3  com.atlassian.jira.component.ComponentAccessor
    4    .getJiraAuthenticationContext()
    5    .getLoggedInUser()?.key
    6)
    7 // 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.

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