I am struggling to add watcher to an issue, the problem here is that
def user = userManager.getUserObject("userid") if (user) watcherManager.startWatching(user, issue)
the above snippet works fine if it's placed in the post-function of the "issue", but what i am trying to achieve is that I am trying to clone an issue using script runner and during that process I am trying to add the assignee of the original issue as a watcher in the issue to be cloned and all this is in the post-function of the original issue thus while logging i get the error
[jira.issue.watchers.DefaultWatcherManager] You must specify an issue.
I feel like I may be overlooking something obvious with my answer, but I'm not sure what it is. At some point in your post-function, the issue is, in fact, created, right? So why not add the previous assignee as a watcher with code similar to the above after the clone is alive and well and before the post-function completes?
I think I know what I missed now. You're using a pre-existing script to clone. I was under the impression that you had already authored your own code to do the cloning. Why not take that pre-existing code, modifying it a bit to fit your needs, and then using as your own custom post-function?
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG