Hi,
How can i automatically add some user as participant or watcher on issue if i @mention them in comment ?
Hi @Bartek dro
You should be able to do it using Scriptrunner, maybe automation for JIRA as well.
For Scriptrunner it would be a listener on MentionIssueCommentEvent:
event.getToUsers()*.getUsername()
Could you show me what the entire script will look like?I'm a total beginner.
Hi
I do not have currently any instance to do some test.
This script should do what you are loking for.
import com.atlassian.jira.user.util.UserManagerimport com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.watchers.WatcherManagerWatcherManager watcherManager = ComponentAccessor.getWatcherManager()UserManager userManager = ComponentAccessor.getUserManager()event.getToUsers()*.getUsername().each{ userNameMentioned -> ApplicationUser userMentioned userManager.getUserByName(userNameMentioned) if(userMentioned){ watcherManager.startWatching(userMentioned, event.getIssue()) }}
Regards
It looks like you're new here. Sign in or register to get started.