Hello,
we recently updated our JIRA to version 7.1.8.
Unfortunately one of our scripts doesn´t work any more.
The upcoming error is:
/secure/CreateIssueDetails.jspa [c.a.j.issue.watchers.DefaultWatcherManager] You must specify a user.
This is the code:
import com.atlassian.jira.component.ComponentAccessor import org.apache.log4j.Category def customFieldManager = ComponentAccessor.getCustomFieldManager() 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 = ["<username>", "<username>", "<username>", "<username>"] def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction") log.setLevel(org.apache.log4j.Level.DEBUG) log.debug "--------------- ADD WATCHER/S --------------" watchUsers(users)
I tried some things but I unfortunately can´t find the error.
It seems like the users are defined wrong.
Can anyone see the error?
Best regards,
Michael
Hi Thanos,
thanks for your answer.
I found the error. JIRA compares the lower case usernames.
So I just had to write the usernames in loser case and the csript worked fine.
hi Michael,
I think your script is right, so as you already noticed the problem should be with the user names, try to add a debug message for the user, and check the user for null before the watcherManager.startWatching(user, issue)
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.