Hello
I am looking for a solution to update schemes for multiple project at once (100 ).
verified adaptivist library able to find for permission scheme.
Issuetype Scheme
Screen Scheme
Workflow Scheme
Field configuration scheme
Can anyone suggest a script/ method that reduce the manual work to update each project.
If anyone looking for a script. the following Scripts will work in Scripted console( Script runner).
Permissions Scheme
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.Project
def list = ["TEST"]
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))
}
Notification Scheme
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.Project
def list = ["TEST"]
for(item in list){
def project = ComponentAccessor.getProjectManager().getProjectByCurrentKey(item)
log.warn("Project is:"+project)
String notificationScheme = "Target Notification Scheme"
ComponentAccessor.getNotificationSchemeManager().removeSchemesFromProject(project)
ComponentAccessor.getNotificationSchemeManager().addSchemeToProject(project, ComponentAccessor.getNotificationSchemeManager().getSchemeObject(notificationScheme))
Work flow Scheme
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.Project
def list = ["TEST"]
for(item in list){
def project = ComponentAccessor.getProjectManager().getProjectByCurrentKey(item)
log.warn("Project is:"+project)
String workflowScheme = "Target Workflow Scheme"
ComponentAccessor.getWorkflowSchemeManager().removeSchemesFromProject(project)
ComponentAccessor.getWorkflowSchemeManager().addSchemeToProject(project, ComponentAccessor.getWorkflowSchemeManager().getSchemeObject(workflowScheme))
But for Other entries IssuetypeScheme, Screen Scheme, Field configuration Scheme Script Is not working.
Using your examples above I figured out Issue Type Screen Scheme, and Field Configuration Scheme. Note: The projects I did this with all used default Schemes, I did not test with ones that had anything beyond default. I also combined them and ran both Issue Type Screen Scheme and Field Configuration Scheme at the same time. Others may need to separate these out.
import com.atlassian.jira.issue.fields.screen.issuetype.IssueTypeScreenScheme
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.Project
def list = [comma separated list of "quoted" project keys]
for(item in list){
def Project project = ComponentAccessor.getProjectManager().getProjectByCurrentKey(item)
log.warn("Project is: " + project)
def IssueTypeScreenScheme screenScheme = ComponentAccessor.getIssueTypeScreenSchemeManager().getIssueTypeScreenScheme(<id of Issue Type Screen Scheme>)
ComponentAccessor.getIssueTypeScreenSchemeManager().addSchemeAssociation(project, screenScheme)
def Long fieldScheme = <id of field configuration scheme>
ComponentAccessor.getFieldLayoutManager().addSchemeAssociation(project, fieldScheme)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.