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

3 votes
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.

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

640 views 6 12
Read article

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