Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

From asignee to a watcher via script runner

Adéla Václavská March 7, 2019

Hi there, any script runner master would help us? We are new to script runner and we are trying to set assignee as a watcher: 

import com.atlassian.jira.component.ComponentAccessor

def watcherManager = ComponentAccessor.getWatcherManager()
watcherManager.startWatching(issue.assignee, event.issue)

It says "no errors found" but while testing on the issue it doesnt work..any ideas to make it work?

 

Thank you!

1 answer

1 accepted

0 votes
Answer accepted
Tarun Sapra
Community Champion
March 7, 2019

Hello @Adéla Václavská 

The syntax of the code looks fine as per the docs

https://docs.atlassian.com/software/jira/docs/api/7.6.1/com/atlassian/jira/issue/watchers/WatcherManager.html#startWatching-com.atlassian.jira.user.ApplicationUser-com.atlassian.jira.issue.Issue-

Have you tried this code in the script console with a dummy issue object and some logging just to be sure that it's working and then add logging in the script listener as well.

Adéla Václavská March 11, 2019

Thank you for suggestion @Tarun Sapra any ideas for the dummy issue object, we are very beginners in terms of scripting

Suggest an answer

Log in or Sign up to answer