Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Service Desk Agent count

Is there a script or a way (UI, app, etc) to get a unique list of Service Desk Agents?  Ideally, by project?  As part of moving from Server to Data Center I'm routinely just auditing all Service Desks via the Workload Report.

Having been on legacy licenses we've enjoyed having wider access for more than people who need it, but the unfortunate side effect is it's hard to really get a grasp of how many unique agents we have because of project overlap and the Service Desks that are not yet refactored.

A more specific example, if I have 3 projects with 4500 agents that have yet to be refactored, is there a way without database queries (as I don't usually have access to such a thing) to exclude those 3 projects and get a number of unique agents in the balance of my instance?

Until I finish refactoring all projects, the only count available to me is the 4500 that is listed on the Application screen, right?

2 answers

1 accepted

0 votes
Answer accepted

Thank you Adaptavist via Twitter. This gives you users of each desk.  It's a start and can adjust things from here.

/**
 * Get all the Applications users that have Service Desk Agent permissions for the
 * all the service desk projects. Run the following script via your Script Console
 */
import com.atlassian.jira.permission.PermissionContextImpl
import com.atlassian.jira.permission.PermissionSchemeManager
import com.atlassian.jira.project.Project
import com.atlassian.jira.project.type.ProjectTypeKey
import com.atlassian.jira.security.plugin.ProjectPermissionKey

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import groovy.xml.MarkupBuilder

StringWriter writer = new StringWriter()
def builder = new MarkupBuilder(writer)

builder.div {
    p("Results")
    ul {
        ComponentAccessor.projectManager.getProjects().findAll { project -> project.projectTypeKey == new ProjectTypeKey("service_desk")}?.each {
            li("$it.name : ${getUsersWithPermissionForProject( new ProjectPermissionKey("SERVICEDESK_AGENT"), it)?.collect {it.displayName}?.join(", ")}")
        }
    }
}

writer.toString()

static Collection <ApplicationUser> getUsersWithPermissionForProject(ProjectPermissionKey permissionKey, Project project) {
    def permissionSchemeManager = ComponentAccessor.getComponent(PermissionSchemeManager)
    permissionSchemeManager.getUsers(permissionKey, new PermissionContextImpl(null, project, null))
}

My only way to do this so far is to go to each of our (55+) service desks, copy all the users from the worklog report, paste them into an xls and then de-dupe them.  

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Data Center

Introducing Data Center Community licenses

I'm Alison Huselid, Head of Product for Data Center at Atlassian. As we shared in our last post, we’ve been working on a solution for those of you who work for charitable non-profit organizations tha...

1,049 views 11 49
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you