6th February, 2023
Automate your administration with ScriptRunner for Jira
Give yourself a headstart on automating management of Users and Groups in Jira with these free scripts and use cases.
We're going to take a deep dive on one of the script snippet collections in the Adaptavist Library: Getting started with Users and Groups in Jira.
This collection focuses on the management of Users and Groups: four scripts to help you automatically reduce the amount of admin time spent on things such as User creation. We've thrown a couple more related script snippets in towards the end of the post too as a bonus!
View snippet collection
Script 1: Jira User properties
User properties enables you to store data that’s specific to user(s), such as location, job role, or phone number. This script allows you to add multiple properties for multiple users with the same script; saving you the task of adding each item manually.
For example, this may be useful if you raise a support request in Jira as you can route the ticket to users who service that location in the issue workflow.
Script 2: Validate the User Group of the Assignee
You may want to ensure that only members of a specific group can be can be added as an assignee. This validator script means you can set this up on any transition that you want this check to be enforced on.
Script 3: Create a User in Jira
Use this script to create a new user in Jira. This snippet benefits you by including validation to check that the user hasn’t already been created. In addition, this script has the ability to collect and log errors for future reference.
Script 4: Create a Group in Jira
In addition to creating users in Jira, it’s often necessary to create groups. For example, a group can be created when multiple users in your instance need the same permissions or restrictions. This script saves you from adding all the users to the group manually.
Bonus scripts: Remove specified Users from a Group and Deactivate Idle Users
There are two ways that you can use the snippet featured in 'Remove specified Users from a Group', either from the ScriptRunner Console as a single script, or as part of a larger script facilitating other features in ScriptRunner for Jira.
Perhaps you want to keep your instances clean and tidy? Use this script alongside the ‘Deactivate Idle Users’ script, the inactive users will be shown and the ‘Remove Specified Users from a Group’ script will remove them from all the groups they’re part of.
View snippet collection
Doing things the hard way?
If you're not already using ScriptRunner for Jira to lighten the load of administrative and manual tasks (and much more besides), take out a free trial. We don't think you'll ever look back.