Reputation: 3
I want to add to JIRA (v6.4.11) next behavior: if person is set as a tester or code reviewer during issue create/edit I need to add person to issue watchers. And vise versa: if person is removed from code reviewers/testers we need to remove this person from watchers list. How can I achieved this?
Upvotes: 0
Views: 1714
Reputation: 929
Use the free add-on JIRA Watcher Field By editing this field you can add/remove watchers from the issue, and you can edit it via scripts (events, behavior plugin, post-functions, etc.)
Here is an example using the Behaviours add-on (part of the ScriptRunner plugin).
First, add a custom field called 'Issue Watchers' of type Watcher Field (available from the Jira watcher plugin) to your screen. Then, create a behaviour, add the 'Tester' field to it, and add the following code to the 'serverside script' section.
FormField testerField = getFieldById("Tester")
FormField watchersField = getFieldByName("Issue Watchers")
String testerUser = testerField.getValue()
String watchers = watchersField.getValue()
watchers = watchers + "," + testerUser
watchersField.setFormValue(watchers)
Upvotes: 1