JIRA SERVER

Watchers field is one of the standard fields of an issue. You can synchronize it as any other issue fields.

This article provides description and scripts that help you to synchronize issue watchers and create new users if they do not exist on the destination side.

The Exalate has a helper method to create users with no permissions. Use this method to sync watchers list.

More details about watchers issue field.

Source side

Add the code below to the Data Filter to send watchers 

 replica.watchers = issue.watchers
 

Destination side  

Add the code below to the Create/Change processors to create users if they don't exist on the receiving side.

 

// WATCHERS SYNC
issue.watchers = replica.watchers.collect { w ->
    def _localW = nodeHelper.getUserByEmail(w.email)
    if (_localW == null) {
        // We create a user with no permissions, and with password equal to the username
        return nodeHelper.createUser(w.username, w.username, w.email, w.displayName)
    }
    _localW
}
// END: WATCHERS SYNC 
 

See Also