How can I set automatic watchers (one or more) to all isues created in the project? I need it for JiraConnect push notifications.
I found the solution. I edit the workflow (diagram) post function in "Create issue" and add Script Post-Function - there URL: /YOUR_URL/atlassian/jira/atlassian-jira/WEB-INF/scripts/groovy/autwatcher.groovy and there I upload file (groovy script) which contains:import com.atlassian.jira.ComponentManagerdef componentManager = ComponentManager.getInstance()def watcherManager = componentManager.getWatcherManager()def userManager = componentManager.getUserUtil()def watchUsers = {usernames -> usernames.each { def user = userManager.getUser(it) watcherManager.startWatching(user, issue.getGenericValue()) }} def users = ["USERNAME"] watchUsers(users)
And it works
Hey Pawel,
You might find this info helpful
https://confluence.atlassian.com/display/JIRAKB/Add+watchers+in+the+Issue+creation+screen
https://jira.atlassian.com/browse/JRA-5493
I read about JIRA Component Watcher but it is now: 503 Service Temporarily Unavailable. Is it something like that what is proper?
503 Service Temporarily Unavailable
https://marketplace.atlassian.com/download/plugins/com.burningcode.jira.issue.customfields.impl.jira-watcher-field/version/96
You could add an Update issues post function to the create issue transition workflow. The general technique is describe here: How to update issues after initial issue create . Watchers is one of the things that can be set or added to.
can we add roles as watchers in groovy scripts when an issue is created
I don't see how post function can be used for this purpose - there are only 2 choises: Update Issue Status and Update Issue Field, and non of them can be used to add watchers to an issue.
Could you tell me, how to do that?
I get below error when i tried to add custom script Post function
2018-07-27 17:48:18,320 ERROR [workflow.ScriptWorkflowFunction]: ************************************************************************************* 2018-07-27 17:48:18,331 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: null, actionId: 1, file: <inline script> groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.ComponentManager.getWatcherManager() is applicable for argument types: () values: [] at Script154.run(Script154.groovy:4)
This is an excellent question Dilyara, have you figured it out?
Have a look at the links Bob gave.
@sledzinski
You might find this info helpful.
Automation:
Step 1: Issue created
Step 2: Manage watchers(hear you can add the watchers list)
It looks like you're new here. Sign in or register to get started.