How to create group in particular directory

Gaurav Agrawal August 24, 2020

Hi there,

I have many directories configured in Jira 8. All directories are enabled. When I create group via UI or REST api, I see group gets created in all the directories (in cwd_group table). 

I want to just create group in one directory. Is it possible? And what is the good way? I am fine with script.

1 answer

0 votes
DES Tools August 26, 2020

Hi Gaurav,

You can use Script Runner plugin and run below code to create group in particular directory:

def directoryManager = ComponentAccessor.getComponent(DirectoryManager)
def GroupTemplate grpTemp = new GroupTemplate("New group name",1)
directoryManager.addGroup(1,grpTemp)

where 1 is directory id. You can see directory id from cwd_directory table.

However, if someone can guide to create a plugin and expose it as REST endpoint, so you can save cost of purchasing Script Runner plugin.

Juan Ramón Alonso García March 21, 2024

A bit too late, but yes... this works!

Suggest an answer

Log in or Sign up to answer