Hello,
How can I add specific users as watchers every time an " error " issue type created? I have checked the link below and provided scripts below does not work for me.- We use JIRA 7.1.
Thank you.
https://answers.atlassian.com/questions/95087
Why don't the scripts in that link work for you?
Just replace "Bug" with your issuetype and "robin" with your username.
import com.atlassian.jira.component.ComponentAccessor def watcherManager = ComponentAccessor.getWatcherManager() def userManager = ComponentAccessor.getUserManager() def issue = event.getIssue() def user = userManager.getUserByName("robin") if (issue.getIssueType().getName() == "Bug") watcherManager.startWatching(user, issue)
Regards,
Robin
Robin,
I am using script Listener to add the watchers and here is what I am getting. I am not familiar with wring scripts, so please be patient with me
Thank you for your understanding,
Steven,
I have posted the error messages I am getting below. Any idea?
I would insert the script to workflow.
Navigate Administration/Issues/Workflows
Edit the workflow you want to change.
Go to the "Create" transition, add a post function, chose "Script Post-Function" and there "Custom script post-function". Paste the code and publish workflow.
As a listener, you have to add:
def issue = event.getIssue()
to line 5.
It's something that you could easily do with JJUPIN:
https://marketplace.atlassian.com/plugins/com.keplerrominfo.jira.plugins.jjupin/server/overview
Can anyone please help me to fix the line below for the script runner?
def user = userManager.getUserByName("dustan", "gabby", "Phillip", "Gerald", "elif", "jon”)
here is the error message I am getting:
image2016-5-6 13:1:32.png
Oh man, you should do some Java tutorials to learn a bit programming.
import com.atlassian.jira.component.ComponentAccessor def watcherManager = ComponentAccessor.getWatcherManager() def userManager = ComponentAccessor.getUserManager() def issue = event.getIssue() def user1 = userManager.getUserByName("dustan") def user2 = userManager.getUserByName("gabby") def user3 = userManager.getUserByName("Phillip") def user4 = userManager.getUserByName("Gerald") def user5 = userManager.getUserByName("elif") def user6 = userManager.getUserByName("jon") if (issue.getIssueType().getName() == "New Contractor") { watcherManager.startWatching(user1, issue) watcherManager.startWatching(user2, issue) watcherManager.startWatching(user3, issue) watcherManager.startWatching(user4, issue) watcherManager.startWatching(user5, issue) watcherManager.startWatching(user6, issue) }
Here is the script I am using. Ofcourse, I am using logon name where it says firstname.lastname but it isnt working for me.
It looks like you're new here. Sign in or register to get started.