Hi ,
I am using Custom script in post-function as Inline script to add watchers in create Issue Transition, Inline script does not show any error while saving , but while creating new ticket it is throwing error in the atlassian-jira.log .
Do i need to do something else for this to get work , kindly help
2016-05-17 19:08:16,825 http-nio-8080-exec-17 ERROR vijay.sridhar 1148x147845x1 t4vsbz 10.10.99.161 secure/CreateIssueDetails.jspa[c.o.s.jira.workflow.ScriptWorkflowFunction]***************************************
2016-05-17 19:08:16,900 http-nio-8080-exec-17 ERROR vijay.sridhar 1148x147845x1 t4vsbz 10.10.99.161 /secure/CreateIssueDetails.jspa [c.o.s.jira.workflow.ScriptWorkflowFunction] Script function failed on issue: null, actionId: 1, file: <i nline script> java.lang.NullPointerException
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.user.util.UserManager;
def watcherManager = ComponentAccessor.getWatcherManager()
def userManager = ComponentAccessor.getUserManager()
def watchUsers = {usernames ->
usernames.each {
def username = userManager.getUserByKey(it.toString())
watcherManager.startWatching(username, issue)
}
}
def grp_users = ["n26_cust1", "n26_cust2","n26_cust3","n26_cust4","n26_cust5"]
watchUsers(grp_users)
groovy_adding_watchers.png
Can you confirm if you put the post-function as last one?
Thanks , it's working ..
what variable should i use for adding the group ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I dont get it, do you want to add a group to the watchers list? It is not possible. From the code i see you trying to add a list of users as watchers. This should be fine. Loop through the list and add them individually.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks . @Vijay Khacharia
Tried to add Users in Particular group to be added as watchers ,So that when ever user created or deleted in JIRA does not require changes @ script level .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can get the users from a group with com.atlassian.jira.security.groups.GroupManager#getUserNamesInGroup(com.atlassian.crowd.embedded.api.Group)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.