Looking for how to implement these 2 features using the Script Runner plugin

It is mentioned on the Script Runner Marketplace page, the ability to 'Automatically add watchers' and also 'Sending a custom email on a transition'. These 2 I would like to try, but would appreciate if you someone can point me to which part of the docs I should review on how to implement these? Possibly I am just not finding it in the documenation link that is provided, Thanks!

4 answers

0 vote

Save it anywhere... yes just plain text with .groovy extention.

In regards to the WATCHER portion of this question, I did find this in another ANSWERS post, but I am not sure about where exactly to save the file, and if it should jsut be a text file with .groovy as the extension ? Also, if this has been used with the Script Runner plugin.

https://answers.atlassian.com/questions/95087/how-do-i-add-a-specific-user-as-a-watcher-using-script-runner

0 vote

Hi Shari... thanks for your review. Should have known there's no such thing as a free lunch ;-)

The built-in script add watcher simply adds the current user to comment or do a transition as a watcher. This is pretty much superfluous now as since it was written, jira by default adds any participant as a watcher.

If you want to add someone other than the current user, create a script file with the contents:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.watchers.WatcherManager

def watcherManager = ComponentAccessor.getWatcherManager()
def user = ComponentAccessor.getUserManager().getUser("someuser")
watcherManager.startWatching(user, issue)

And create a post-function or listener (Scripted function from the list) and point to this file.

Sending a mail with a custom template is described here: https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Sendacustomemail

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

72 views 0 11
Read article

Atlassian User Groups

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!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you