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
4,294,189
Community Members
 
Community Events
165
Community Groups

Bulk Change Project Schemes with Script Runner / Groovy Script

Hello,

i like to bulk change Project Schemes with Script Runner. 

For Example change all Issue Type Screen Schemes or Workflows etc.

Is there any Script out there to accomplish this?


Thanks!

2 answers

Here is the working code, folks!! It perfectly works.

*Just copy and paste* in your Script Runner's Script Console. Replace the below Project keys with your list (you can put up to *50 Project keys in one go*.. it processed first 50 keys, when I added 75 keys) and replace the Target Permission Scheme name.
====================

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.Project

def list = ["Proj Key 1", "Proj Key 2", "Proj Key 3", "Proj Key 4"]

for(item in list){
def project = ComponentAccessor.getProjectManager().getProjectByCurrentKey(item)

log.warn("Project is:"+project)

String permissionScheme = "Target Permission Scheme"

ComponentAccessor.getPermissionSchemeManager().removeSchemesFromProject(project)
ComponentAccessor.getPermissionSchemeManager().addSchemeToProject(project, ComponentAccessor.getPermissionSchemeManager().getSchemeObject(permissionScheme))
}

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

255 views 0 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