Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

auto re-assign issues from deactivated users

Davor Fisher
Contributor
January 29, 2020

Looking to see if anyone has any thoughts on a possibility to have a script that runs periodically and looks for open issues assigned to inactive users (disabled) and then it re-assigns to either a default use or project lead for specific project set within the script. The script could be run manually/automatically and could also be scripted to run against certain project(s).

We are looking to help our projects leads/admin get more visibility on open issues assigned to  users that are no longer with company. 

1 answer

1 vote
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2020

I would use a scriptrunner escalation service for this and combine it with inactiveUsers() JQL function.

Something like this:

  • JQL Query: project =JSP and assignee in inactiveUsers() and resolution is empty
  • As User: Pick a user 
  • Leave the Action to None
  • Add a bit of script in Additional Issue Action.

Because we're using none, we can't use the issueParameters. We have to code the complete update:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.util.ImportUtils
import com.atlassian.jira.issue.index.IssueIndexingService
def issueIndexingService = ComponentAccessor.getComponent(IssueIndexingService.class)
//current user will be the runas parameter
def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser

//static user
def user = ComponentAccessor.userManager.getUserByName('p6s')
//project lead
//def user = issue.projectObject.projectLead

//set the new assignee
issue.setAssignee(user)

//store the value
ComponentAccessor.issueManager.updateIssue(currentUser,issue,

//re-index the issue
EventDispatchOption.DO_NOT_DISPATCH,false)
def wasIndexing = ImportUtils.isIndexIssues()
ImportUtils.setIndexIssues(true)
issueIndexingService.reIndex(issue)
ImportUtils.setIndexIssues(wasIndexing)

Suggest an answer

Log in or Sign up to answer