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?
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.
<span><a href="https://docs.atlassian.com/software/jira/docs/api/7.1.7/com/atlassian/jira/issue/fields/config/manager/FieldConfigSchemeManager.html#removeFieldConfigScheme-java.lang.Long-" target="_blank" rel="nofollow noopener noreferrer">removeFieldConfigScheme</a></span>(<a href="http://download.oracle.com/javase/7/docs/api/java/lang/Long.html?is-external=true" title="class or interface in java.lang" target="_blank" rel="nofollow noopener noreferrer">Long</a> fieldConfigSchemeId)Removes a field config scheme, as well as its associated contexts and field configs (which includes option sets and generic configs)
<span><a href="https://docs.atlassian.com/software/jira/docs/api/7.1.7/com/atlassian/jira/issue/fields/config/manager/FieldConfigSchemeManager.html#removeFieldConfigScheme-java.lang.Long-" target="_blank" rel="nofollow noopener noreferrer">removeFieldConfigScheme</a></span>(<a href="http://download.oracle.com/javase/7/docs/api/java/lang/Long.html?is-external=true" title="class or interface in java.lang" target="_blank" rel="nofollow noopener noreferrer">Long</a> fieldConfigSchemeId)
<span><a href="https://docs.atlassian.com/software/jira/docs/api/7.1.7/com/atlassian/jira/issue/fields/config/manager/FieldConfigSchemeManager.html#removeInvalidFieldConfigSchemesForCustomField-java.lang.String-" target="_blank" rel="nofollow noopener noreferrer">removeInvalidFieldConfigSchemesForCustomField</a></span>(<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" target="_blank" rel="nofollow noopener noreferrer">String</a> customFieldId)Given a CustomField, this method will correctly remove the fieldConfigSchemes if necessary.
<span><a href="https://docs.atlassian.com/software/jira/docs/api/7.1.7/com/atlassian/jira/issue/fields/config/manager/FieldConfigSchemeManager.html#removeInvalidFieldConfigSchemesForCustomField-java.lang.String-" target="_blank" rel="nofollow noopener noreferrer">removeInvalidFieldConfigSchemesForCustomField</a></span>(<a href="http://download.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" target="_blank" rel="nofollow noopener noreferrer">String</a> customFieldId)
<span><a href="https://docs.atlassian.com/software/jira/docs/api/7.1.7/com/atlassian/jira/issue/fields/config/manager/FieldConfigSchemeManager.html#removeInvalidFieldConfigSchemesForIssueType-com.atlassian.jira.issue.issuetype.IssueType-" target="_blank" rel="nofollow noopener noreferrer">removeInvalidFieldConfigSchemesForIssueType</a></span>(<a href="https://docs.atlassian.com/software/jira/docs/api/7.1.7/com/atlassian/jira/issue/issuetype/IssueType.html" title="interface in com.atlassian.jira.issue.issuetype" target="_blank" rel="nofollow noopener noreferrer">IssueType</a> issueType)Given an issueType, this method will correctly remove the fieldConfigSchemes if necessary.
<span><a href="https://docs.atlassian.com/software/jira/docs/api/7.1.7/com/atlassian/jira/issue/fields/config/manager/FieldConfigSchemeManager.html#removeInvalidFieldConfigSchemesForIssueType-com.atlassian.jira.issue.issuetype.IssueType-" target="_blank" rel="nofollow noopener noreferrer">removeInvalidFieldConfigSchemesForIssueType</a></span>(<a href="https://docs.atlassian.com/software/jira/docs/api/7.1.7/com/atlassian/jira/issue/issuetype/IssueType.html" title="interface in com.atlassian.jira.issue.issuetype" target="_blank" rel="nofollow noopener noreferrer">IssueType</a> issueType)
Please keep posted for any questions.
Thanks,
RamaRao
Hi @Naman Mandli ,
If you feel like my answer helped you, kindly mark my answer as accepted.
@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.
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.ComponentAccessordef 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 }}
It looks like you're new here. Sign in or register to get started.