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

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

How to bulk disable/inactive users in jira on csv file using scriptrunner

 Hi Community,

Good day! Just want to ask if how can I bulk disable/inactive users in JIRA  on csv file using scriptrunner? Currently I'm using this code to disable single user but I do want to do this on bulk and get users from csv file instead of hardcode.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.JiraServiceContextImpl
import com.atlassian.crowd.embedded.impl.ImmutableUser
import com.atlassian.jira.user.DelegatingApplicationUser
import com.atlassian.jira.bc.user.UserService
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def jiraServiceContext = new JiraServiceContextImpl(currentUser)
def userSearchService = ComponentAccessor.getComponent(UserSearchService.class)
def userService = ComponentAccessor.getComponent(UserService.class)
def userlist = ['alvin_sample', 'alvin_cust']
for (item in userlist) {
def appUser = userSearchService.getUserByName(jiraServiceContext, 'test')
def errors = ''
if (appUser != null) {

ImmutableUser.Builder builder = ImmutableUser.newUser(appUser.getDirectoryUser());
//builder.displayName('New display name')
def updateUser = new DelegatingApplicationUser(appUser.getId(), appUser.getKey(), builder.toUser());

def updateUserValidationResult = userService.validateUpdateUser(updateUser)
if (updateUserValidationResult.isValid()) {
} else {
errors += "Update of ${} failed: ${updateUserValidationResult.getErrorCollection().getErrors().entrySet().join(',')}\n"


Any help is appreciated. thank you!

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Trello

Taco Tuesday: Your favorite Trello blog takeaway

Hello friends! From the community that brought you Welcome Wednesday, Throwback Thursday and Friday Fun, welcome to Taco Tuesday, a weekly discussion about all things Trello. The best part? One Tac...

116 views 6 6
Join discussion

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