How to Impersonate a Comment in Zendesk

    By default, Exalate adds a comment, received from the other side on behalf of the proxy user. The comment looks like the following:

    You can change this behavior. For example, create the received comment with the original comment author. The comment object has a field Executor which can be set to any user. This is how you can impersonate synced comments.

    Source side

    Outgoing sync 

    To send comments to the destination instance use the following script:

    replica.comments = issue.comments

    Destination side

    You can apply the received comment in different ways:

    1. Assign the original comment author if exists in the local system and create a new user if not found.

    This method works only for Jira Server.

    Incoming sync

    • Check if the author of the comment exists in the local system by doing a user lookup
    • If the author does not exist in the local JIRA, create a new user
    • Assign this user as a comment executor
    issue.comments = commentHelper.mergeComments(issue, replica, {
      comment ->
      def authorUser = userHelper.getByEmail(
      // set the executor, optionally create the user if the local user is not found
      comment.executor = authorUser ?: userHelper.createUser(, 
                                                         "changeme", //password !

    2. Assign the original comment author if exists in the local system, use the proxy user if not found.

    This method works for Jira Server and Jira Cloud.

    Incoming sync

    • Change the comment executor from the proxy user to the original comment author
    • If the author does not exist in the local JIRA, use the proxy user as an author
    replica.addedComments.each { it.executor = nodeHelper.getUserByEmail( }
    replica.changedComments.each { it.executor = nodeHelper.getUserByEmail(it.updateAuthor?.email) }
    issue.comments = commentHelper.mergeComments(issue, replica, { it })

    The first comment was created by the proxy user, while the second comment was impersonated and the local administrator is the comment executor.

    Incoming sync 

    replica.addedComments.each { it.executor = nodeHelper.getUser("361777654679") } // replace "361777654679" with the zendesk user id
    issue.comments     += replica.addedComments

    Incoming sync 

    def targetUser = nodeHelper.getUserByEmail("")
    issue.comments     = commentHelper.mergeComments(issue, replica, {
        it.executor = targetUser