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.
A bit late to the party, so I am sure you already figured it out.
Basically, all suggested scripts are for the Server/Data Center version.
Check the documentation: ScriptRunner Cloud Documentation
But for all who come to this question, the Cloud version of ScriptRunner doesn't use the "import" anymore.
And if you come to this question searching for Cloud solution for all users. I am sorry, but the API call to "Get all users" is not supported:
https://community.developer.atlassian.com/t/scriptrunner-get-all-users/71956
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.