Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


How do I delete a field configuration scheme via scriptrunner?

Quite simple what I'm trying to do, I have an array of field configuration schemes (projectlessFieldConfigSchemes) that I would like to delete. I attempt the code below to remove just the first of the array.


def fieldConfigSchemeMgr = ComponentAccessor.getFieldConfigSchemeManager()
def temp= projectlessFieldConfigSchemes[0] as FieldConfigurationScheme
The error I am getting is such:
java.lang.NullPointerException at com.atlassian.jira.issue.context.persistence.FieldConfigContextPersisterWorker.removeContextsForConfigScheme( at com.atlassian.jira.issue.context.persistence.CachingFieldConfigContextPersister.removeContextsForConfigScheme( at com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManagerImpl.removeFieldConfigScheme( at
I also tried using the FieldLayoutManager instead and here is the code and error.
def temp= projectlessFieldConfigSchemes[0] as FieldConfigurationScheme
groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.fields.layout.field.DefaultFieldLayoutManager.deleteFieldLayoutScheme() is applicable for argument types: (com.atlassian.jira.issue.fields.layout.field.enterprise.ImmutableFieldConfigurationScheme) values: [com.atlassian.jira.issue.fields.layout.field.enterprise.ImmutableFieldConfigurationScheme@#############]

3 answers

This was a very confusing thread to follow. For anyone seeing this in the future here is the code to delete a set of field configurations by their ID.



import com.atlassian.jira.component.ComponentAccessor

def fieldConfigSchemeMgr = ComponentAccessor.fieldLayoutManager

def layouts = []

for (l in layouts) {

def layout = fieldConfigSchemeMgr.getFieldLayout(l)




Thanks for this code snippet! Is this to delete a field configuration scheme, or just the field configuration/layout?

You can delete the schemes in this way.

def fieldLayoutManager = ComponentAccessor.getFieldLayoutManager()
def temp = fieldLayoutManager.getFieldLayoutSchemes()
Anyone looking should be able to extrapolate what they need into an if and then an each. Best of luck to anyone trying to understand the difference between
fieldLayoutManager.getFieldConfigurationScheme(x). Unfortunately, that answer was not found in this discussion.

fieldConfigSchemeMgr.getFieldConfigScheme will get you the issuetype scheme, while the other gets you the field configuration scheme -> don't know why the naming is so weird in the API

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 02, 2022

Welcome to the Atlassian Community!

Immutable objects do not have function calls that change them, so your second try is always going to fail.

In your fist bit of code, I don't think your temp object contains anything.

Thank you for your interest. So the first bit of code is referring to an array of Field Configuration Schemes that I gathered via the command

So I can with certainty say that there are Field Configuration Schemes in the array. You're right that it's Immutable, but I'm not sure how to call or if it is possible to call a mutable field config scheme to make the second code set work ever.

It's probably important to note that this code is being run via the scriptrunner console.
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 02, 2022

But you're not putting anything into the "temp" variable, unless you've not given us all the code.

I did not, just put in the lines that led to the error since the full code is quite long and unnecessary. I have gone ahead and simplified the code with the error to be self-contained. FCS 13300 exists. I am certain there is something small I am missing, but can't find any working examples online either.


import com.atlassian.jira.component.ComponentAccessor
def fieldConfigSchemeMgr = ComponentAccessor.fieldConfigSchemeManager


Very interesting development this: 

Returns null! So you're definitely onto something of me grabbing nothing. But get this, if I grab it like this:
I get the scheme I'm looking for. Why is it not finding this?
I looked at the groovy documentation and removeFieldConfigScheme(Long fieldConfigSchemeId) vs getFieldConfigurationScheme(Long schemeId)

What would the difference be in fieldConfigSchemeId and schemeId? Maybe this base misunderstanding is the root of my issue?
getFieldConfigScheme() returns issue type schemes! Why?! Groovy, why.

I still would love some insight into this as you would think that the method "getFieldConfigScheme" would return a Field Config Scheme, but I have gotten the code to work with

def fieldLayoutManager = ComponentAccessor.getFieldLayoutManager()
def temp = fieldLayoutManager.getFieldLayoutSchemes()
But please still please point me in the direction of any good documentation on this because I was not able to find any and would truly like to understand the "why" behind this.
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 03, 2022

I am very confused by your postings of partial bits of code, so I am not sure what you would like a pointer to. 

But I suspect it would be a part of

Nope, that's the documentation I referred to earlier that was not great, but I have answered the based question for myself and posted the code for others, so I'll go ahead and close the question.

Suggest an answer

Log in or Sign up to answer