Round Robin assignment based on user roles when the assignee can be in multiple roles

Jillian Menoche June 9, 2021

I am looking to do round robin assignment using Automation Lite for Jira or possibly Scriptrunner for Jira Server 8.13

I set up a general role that holds all assignees for round robin assignment.  I also set up user roles representing skillsets.  Assignees may be in more than one "skillset" role.

  • Current State
    • Using Automation Lite, I set up a master timed job that runs every 11 minutes and checks the assign user column to see if there are any tickets ready for assignment
    • Any tickets in the column are updated round robin from the "General Role"
    • I then have 13 different "skillset" jobs running every 5 minutes checking that same column to see if the user is assigned to the respective "skillset" role which is based off of a custom skillset field.  
    • If there is a match, it moves it into the assigned column and the user gets a notification
    • If the user is not a match, it does nothing and waits for the 11 minute job to reassign it.
    • This continues until a match is found.

 

The 11 minute and 5 minute rules work well.  The issue is that when a match is not found, instead of returning back to the user that wasn't a match, it moves on to the next person.  This means a lot of people are getting skipped and people with more skillsets are getting more assignments.

Any idea how I can solve for this?  I also tried balanced workload but it did not seem to do anything and seemed to assign the same people over and over for some reason.

1 answer

0 votes
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 9, 2021

Hi @Jillian Menoche Welcome to Atlassian Community!

You can achieve this using Script Runner , kindly check below link for round robin :- 

https://library.adaptavist.com/entity/round-robin-assign-issue-to-users-in-a-certain-project-role

Thanks

Jillian Menoche June 9, 2021

Thank you for the quick response! 

 

I should mention I saw this link and pasted the code in but couldn't get off the ground as it gave me the following error at line 17:  can't find method projectRoleManager.getProjectRoleActors(projectRole, issue.projectObject)

 

any thoughts on what may be happening there?  Thanks again!

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 9, 2021

Hi @Jillian Menoche  I have tested the same script on my machine. It's working fine, not giving any error message. You have to insert this in Scripted Post function. 

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager

// The role you want assignees to set from
final roleName = 'Administrators'

// If it is true, the assigned issues will be reassigned
final reassignedIssues = true

def issueManager = ComponentAccessor.issueManager
def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)

// Get all of the users associated with the specified project role
def projectRole = projectRoleManager.getProjectRole(roleName)

// Sort the users of the project role using the user key
def users = projectRoleManager.getProjectRoleActors(projectRole, issue.projectObject)
.applicationUsers
.toSorted { it.key }

// There are no users in the specific project role
if (!users) {
log.info ("No users for project role $roleName")
return
}

if (!reassignedIssues && issue.assignee) {
log.info ('The issue is already assigned')
return
}

// Find the latest created issue id that has an assignee
def lastIssueIdWithAssignee = issueManager.getIssueIdsForProject(issue.projectObject.id)
.sort()
.reverse()
.find { issueManager.getIssueObject(it).assignee }

if (!lastIssueIdWithAssignee) {
issue.setAssignee(users.first())
return
}

def lastAssignee = issueManager.getIssueObject(lastIssueIdWithAssignee).assignee
def lastAssigneeIndex = users.indexOf(lastAssignee)
def nextAssignee = users[(lastAssigneeIndex + 1) % users.size()]

issue.setAssignee(nextAssignee)
Abdel-Malek, David July 15, 2021

Doesn't work. No errors but it only keeps assigning to one person.

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2021

Hi @Peter-Dave Sheehan  kindly suggest . Round robin is not working.

thanks

Suggest an answer

Log in or Sign up to answer