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 do I set certain groups to a new JIRA project as part of a specific Project Role using JIRA API?

I'm using JIRA 8.0.3. We had a need to programmatically create JIRA projects from an existing template which would be triggered in a workflow transition as part of a new Issue Type. I was able to do this successfully by using the JIRA API from a post-function inline script (ScriptRunner).

As a next step, I need to add groups to specific Project Roles for the newly created JIRA project. Please bear in mind that the groups would be unique for each new JIRA project. I did look into JIRA API about ProjectRole, ProjectRoleManager and ProjectRoleService. However, the method addActorsToProjectRole expects a Collection of Actors. In my case, the group name to add would be a String. So I'm not sure how to proceed.

Here is my existing code (projKey, projName, projLead are user-entered information; origUser is the user who is person clicking on the workflow transition to create the project) -

Builder builder = new Builder()
def data =
// Validate whether logged in origUser  has privileges to create the project from existing Project Template

def projectResult = projectService.validateCreateProjectBasedOnExistingProject(origUser, PROJECT_TEMPLATE_PID, data)

Project prj = projectService.createProject(projectResult)

The above snippet works for creating a new project with the existing project template id.

However, I'm stuck now trying to add groups to the project for specific project roles. I have looked at the below documentation but can only find addActorsToProjectRole (as mentioned above) and nothing related to adding users or groups to a project role for a project.

0 answers

Suggest an answer

Log in or Sign up to answer

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