Hi All,
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?
Hi Tanner,
I don't think the target issue(issue to be cloned) is created in the post-function as the whole point of using the post function is to create the issue itself, and once the post-fcuntion executes only then the target issue is created.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually I was looking for a way to avoid custom code, as in a Large and complex jira instance, custom code sometimes add to maintenance woes of admins/developers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yep. it can be a headache sometimes.
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.