Automatically add watchers to the issues on creation
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
One of the requirement users/admins will have while working on the issues in real time in Jira projects is to add themselves as the watchers to the tickets so that they can stay updated. Sometimes it can be a cumbersome task for admins to add same set of users to the tickets as watchers everytime. In order to avoid the same, we can have an automated action in Jira to achieve the same if the list of users in known apriori.
The solution we are going to discuss is ways to add users automatically as watchers whenever a ticket is created in a specific project.
Environment
- Jira Software and Jira Service Management Data Center editions (9.X / 5.X) respectively.
- Older versions with 'Automation for Jira' plugin installed are also benefited from this article.
Steps
If you are using Jira Software and Jira Service Management Data Center editions (9.X / 5.X) respectively, then you will have the 'Automation for Jira' bundled plugin which you can explore to meet this requirement. You can simply create an automation rule as described in next few steps to achieve this. You can also use Jira native REST API to meet the same is you are not using 'Automation for Jira' for any specific reason.
Steps to create Automation Rule (using A4J) to add Watchers on Issue Creation:
- Navigate to 'System --> Automation Rules --> Create New Rule' option to create a new automation rule.
- Provide the Rule details such as RuleName, Scope(Projects) and select the trigger 'When: Issue created' and save the rule.
- Under the 'Add component' actions choose 'New Action --> Manage Watchers' and add the list of users you prefer to add.
Please note that you can only add the users list, adding groups is not allowed.
- Now save the details and turn on the rule, sample screenshot of the rule created for local testing is attached for reference.
- Now try creating a new issue and validate the behaviour, you should be able see the list of users provided in the automation rules as part of the watchers list.
Alternate Solution for Admins not using A4J
- There is a REST API call for adding a watchers to the issue, here is the reference: Add watcher.
- You can test locally using the API call to confirm operation and then look at including in a script or post function as desired to meet the requirements.
Conclusion
Through this exercise, we believe you should be able to automatically add watchers to the Jira Issues on creation. Please note that this is at user level (not group level), you need to add the list of users to the automation rule.