Delete Unused Field Configuration/Field Configuration Scheme

Naman Mandli
Contributor
July 12, 2019

I am mange to delete screen, screen scheme, issue type screen scheme. 

Is there any script to bulk delete Unused Field Configuration/Field Configuration Scheme?

2 answers

0 votes
Joachim Brechtel
Contributor
June 12, 2020

Hi,

I think you should use the FieldLayoutManager instead of the FieldConfigSchemeManager from the answer above. If you have a list of ID's you can use

import com.atlassian.jira.component.ComponentAccessor

def fieldLayoutManager = ComponentAccessor.getFieldLayoutManager()

def toDelete = [12345L, 23456L, ...]

toDelete.each {
try {
def scheme = fieldLayoutManager.getMutableFieldLayoutScheme(it)
fieldLayoutManager.removeFieldLayoutScheme(scheme)
} catch (Exception e) {
log.error "Could not delete field config scheme " + it
}
}
0 votes
Ramarao Gaggara {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 14, 2019

Hi @Naman Mandli ~ I hope you are able to delete screen, screen scheme and issue type screen scheme through Atlassian SDK.

Below API methods from Atlassian SDK might help you to delete Field Configuration Scheme/s.

removeFieldConfigScheme(Long fieldConfigSchemeId)Removes a field config scheme, as well as its associated contexts and field configs (which includes option sets and generic configs)

removeInvalidFieldConfigSchemesForCustomField(String customFieldId)Given a CustomField, this method will correctly remove the fieldConfigSchemes if necessary.

removeInvalidFieldConfigSchemesForIssueType(IssueType issueType)Given an issueType, this method will correctly remove the fieldConfigSchemes if necessary.

Please keep posted for any questions.

Thanks,

RamaRao

Ramarao Gaggara {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 28, 2019

Hi @Naman Mandli ,

If you feel like my answer helped you, kindly mark my answer as accepted.

Thanks,

RamaRao

Ahsan September 1, 2019

@Ramarao Gaggara {Appfire} 

 

Is there any script to delete unused Field Configuration Schemes, Field Configurations and Fields?

Also, Unused Issue Types Schemes and Issue Types.

Thanks in advance. 

 

Suggest an answer

Log in or Sign up to answer