Hi,
I need to lookup users in jira groups depending on value in a custom field "Site". I have tried to write the below function, which works if I write in the actual group name, shown below. What I need is an if statement (or similar) that sets a group name to the variable "group", which is then returned by the function.
Can this be achieved? Can similar behaviour be achieved with different technique?
Thanks
def lookupGroupMembers(String s){
/*
Parameter s = site
retVal = List of users
*/
def group = "None"
if ( s == "Site1" ){ group = "made-up-Jira-group"}
/* This works - using group name*/
def groupManager = ComponentAccessor.getGroupManager()
def retVal = groupManager.getUsersInGroup("made-up-jira-group")
/* This does not work - using group variable */
def groupManager = ComponentAccessor.getGroupManager()
def retVal = groupManager.getUsersInGroup("group")
return retVal
}
You need to change line:
def retVal = groupManager.getUsersInGroup("group")
.. and use the variable instead..
def retVal = groupManager.getUsersInGroup(group)
Regards
Thanks! Worked like a charm :)
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.