Is there a way to rename issuetypescheme using groovy script or other.

I was able to rename the other entities using groovy but not finding any method to rename the issuetypescheme.

Any help regarding the method for renaming issuetypescheme would be helpful.

Thanks in advance

2 answers

1 accepted

This widget could not be displayed.
Henning Tietgens Community Champion Oct 09, 2013

I think you have to use FieldConfigSchemeManager.updateFieldConfigScheme(FieldConfigScheme scheme), because the IssueTypeScheme is a FieldConfigScheme. But I don't tested that.

It does not give me an option of supplying the new name.

Also I have tried FieldConfigScheme.Builder.setName(" New Scheme Name ").toFieldConfigScheme()

Then supplying the above scheme to the FieldConfigSchemeManager.updateFieldConfigScheme(FieldConfigScheme scheme)

But , it is giving me a Null pointer probably because FieldConfigScheme.Builder.setName(" New Scheme Name ").toFieldConfigScheme() changes the object reference to another scheme which does not exist in the Jira Instance.

It would be great if you test the code and Help me.

Are there any other options available if this cannot be done through groovy.

Thanks in advance

Henning Tietgens Community Champion Oct 09, 2013

Ok, I tried the following and it works.

import com.atlassian.event.api.EventPublisher
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.ClearCacheEvent
import com.atlassian.jira.issue.fields.config.FieldConfigScheme
import com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManager
import com.atlassian.jira.issue.fields.config.manager.IssueTypeSchemeManager
import com.atlassian.jira.project.ProjectManager

IssueTypeSchemeManager issueTypeSchemeManager = ComponentAccessor.getIssueTypeSchemeManager()
ProjectManager projectManager = ComponentAccessor.getProjectManager()
FieldConfigSchemeManager fieldConfigSchemeManager = ComponentAccessor.getComponent(FieldConfigSchemeManager)
EventPublisher eventPublisher = ComponentAccessor.getComponent(EventPublisher)

def project = projectManager.getProjectObjByKey('TST')
def its = issueTypeSchemeManager.getConfigScheme(project)
def its_new = (new FieldConfigScheme.Builder(its)).setName( + ' 2').toFieldConfigScheme()
its = issueTypeSchemeManager.getConfigScheme(project)

It appends " 2" to the IssueTypeScheme name of the IssueTypeScheme used by the TST project. After the change it seems that the cache has to be cleared to make the change visible. I don't know if this is the way it should be done, but it works.

Thats a nice catch ... I never thought of clearing the cache (I must admit).

I will try it again and see if it is working.

Thanks a ton .... :)

Greatly appreciate your help.



You should definitely mark Henning's answer as correct seeing as he's gone to the trouble of writing some code, and even testing it (!). This kind of thing is a non-trivial amount of effort.

This widget could not be displayed.

the above code is working absolutely fine as expected... I

added eventPublisher.publish(ClearCacheEvent.INSTANCE) line in my code and it worked fine.

Is there any specific reason why this rename was possible only after the ClearCacheEvent.INSTANCE.

For other entities the rename was happening fine without firing any such event {Just for curiosity}



Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

148 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you