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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Use Scriptrunner to add multiple groups to a single user


I am new to Scriptrunner and I want to speed up the onboarding process by building some "persona" style scripts. For example,

User - "Project manager" requires "jira-user", "jira-software", "customer-share" groups

(I usually have 20-30 groups to add)

Is there a script I could use to run to add this in?



2 answers

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 16, 2022

I think you can pretty much copy and paste the script over at - swapping the line at the end from removeUserFromGroup to addUserToGroup

0 votes
Ravi Sagar _Sparxsys_
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.
May 16, 2022

Hi @David Lee 

You would need to use group manager to do that. It is very simple script.

ComponentAccessor.groupManager.addUserToGroup(userToAdd, groupName)

I made a video and shared the script with some error handling in one of my video here.



Thanks @Ravi Sagar _Sparxsys_ for the information, I am able to add single groups without error with this script.


What would I need to do to this to add in another group? Or do I just need to run it multiple times, changing the "group1" each time?
import com.atlassian.jira.component.ComponentAccessor
def userName = "User"
def groupNametoAdd = "group1"
def userToAdd = ComponentAccessor.getUserManager().getUserByName(userName)
def groupName = ComponentAccessor.getGroupManager().getGroup(groupNametoAdd)

ComponentAccessor.groupManager.addUserToGroup(userToAdd, groupName)

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events