Created
March 15, 2021 17:41
-
-
Save jechlin-adaptavist/7274b0e5ca085d3819c615b275031eab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
import com.atlassian.jira.issue.fields.FieldManager | |
import com.atlassian.jira.issue.fields.screen.FieldScreenManager | |
def fieldScreenManager = ComponentAccessor.getComponent(FieldScreenManager) | |
def fieldManager = ComponentAccessor.getComponent(FieldManager) | |
// change to false to remove invalid fields | |
def preview = true | |
fieldScreenManager.fieldScreens.each { screen -> | |
screen.tabs.each { tab -> | |
tab.fieldScreenLayoutItems.findAll { layoutItem -> | |
!fieldManager.getField(layoutItem.fieldId) | |
}.each { layoutItem -> | |
log.warn("Missing field: $layoutItem.fieldId on screen: '$screen.name', tab: '${tab.name}'") | |
if (!preview) { | |
tab.removeFieldScreenLayoutItem(layoutItem.position) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment