You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi,
I'm trying to put a script together to get a list of all users (cloud version), script/error below. Can anyone offer any guidance with this?
Thanks!
Mark
Script:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.user.util.UserUtil UserUtil userUtil = ComponentAccessor.getUserUtil() result = ” userUtil.getUsers().each{ u -> result += u.emailAddress } result
Error:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 2: unable to resolve class com.atlassian.jira.user.util.UserUtil
@ line 2, column 1.
import com.atlassian.jira.user.util.UserUtil
^
Script1.groovy: 1: unable to resolve class com.atlassian.jira.component.ComponentAccessor
@ line 1, column 1.
import com.atlassian.jira.component.ComponentAccessor
^
2 errors
at com.adaptavist.sr.cloud.workflow.AbstractScript.parseScript(AbstractScript.groovy:41)
at com.adaptavist.sr.cloud.workflow.AbstractScript.evaluate(AbstractScript.groovy:28)
at com.adaptavist.sr.cloud.workflow.AbstractScript$evaluate$1.callCurrent(Unknown Source)
at com.adaptavist.sr.cloud.events.ScriptExecution.run(ScriptExecution.groovy:26)
at ScriptExecution1_groovyProxy.run(Unknown Source)
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserUtil
UserUtil userUtil = ComponentAccessor.getUserUtil()
def result = ""
userUtil.getUsers().each{ u ->
result += u.username + "<br>"
}
result
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, this code is correct and works, but your version works too.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.user.util.UserUtil UserUtil userUtil = ComponentAccessor.getUserUtil() def result = "" userUtil.getUsers().each{ u -> result += u.emailAddress } result
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could this be modified to output users and number them so I can get a count of total users.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I need the same... anyone who knows the answer?
Thanks...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
could this be modified to output users per project?
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.