You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello, i get an error in logs my post-function (in Workflow)
my code :
import com.atlassian.jira.component.ComponentAccessor
def watcherManager = ComponentAccessor.getWatcherManager()
def userManager = ComponentAccessor.getUserManager()
def watchUsers = {usernames ->
usernames.each {
def user = userManager.getUserByKey(it.toString())
watcherManager.startWatching(user, issue)
}
}
def users = ["n.lubyanskaya", "a.belyaeva","e.fedoseeva", "e.dushnova", "l.golovanova", "a.zaretskaya","v.moshkarova","a.zamekhovskaya","e.kozhukhova"]
watchUsers(users)
What could be the problem ?
logs:
2022-06-10 11:18:51,737 ERROR [watchers.DefaultWatcherManager]: You must specify a user.
2022-06-10 11:18:51,817 ERROR [watchers.DefaultWatcherManager]: You must specify a user.
2022-06-10 11:18:51,888 ERROR [watchers.DefaultWatcherManager]: You must specify a user.
2022-06-10 11:18:51,928 ERROR [watchers.DefaultWatcherManager]: You must specify a user.
2022-06-10 11:18:51,962 ERROR [watchers.DefaultWatcherManager]: You must specify a user.
Hi @Oliver Smith Kindly use following script for adding multiple users as watcher, update usernames as per your requirement :-
Kindly move scripted post function after "Creates the issue originally." post function, if you are applying script on create issue transition.
import com.atlassian.jira.component.ComponentAccessor
def userManager = ComponentAccessor.getUserManager()
def watcherManager = ComponentAccessor.getWatcherManager()
def watcher = ["username1","username2"]
watcher.each{userName->
def user=ComponentAccessor.userManager.getUserByName(userName)
watcherManager.startWatching(user, issue)
}
Thanks
V.Y
@Vikrant Yadav , thank you very much, everything works! Have a nice day! :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You’re Welcome 😇 Have a great weekend
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.