Hi , I would like to return all groups which have been assigned to a specific user in jira. Could anyone help me ?
Hi
It depends on the context (is it for a listener, workflow function, etc), but in general try this in a script console
import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.getGroupManager()
def userName = "admin"
def groupsForUser = groupManager.getGroupsForUser(userName) // a Collection <Group>
def groupsForUserString = groupManager.getGroupsForUser(userName)?.collect {it.name}?.join(", ") //a comma separated String representation of the collection
log.debug "Groups for user ${groupsForUserString}"regards, Thanos
 
 
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.