requires sender/reporter user to have MANAGE_WATCHERS permission!
This Field Processor Script work on create only (uses relatedIssue and requires ccAddresses to be non null):
Script:
if (relatedIssue === null && ccAddresses!==null && ccAddresses.length>0) { var watcherCsvUsernames=''; for(var i = 0; i < ccAddresses.length; i++) { var jiraUser = jemhUtils.getUserByEmail(ccAddresses[i].getAddress()); if (jiraUser !==null) { print('found cc jira user: '+jiraUser.getUsername()); if (watcherCsvUsernames.length>0) { watcherCsvUsernames+=","; } watcherCsvUsernames+=jiraUser.getUsername(); } } resultMap.put("watchers", watcherCsvUsernames); } else { print('no cc recipients'); }
Screenshot: