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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.UserManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.watchers.WatcherManager
WatcherManager 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
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.