Hi,
I need get list of custom fields which I have on all of screens on a project.
Have you any advice how can I get this by groovy script?
Thanks
Hi Lukas,
I ended up in the exactly same situation as you and solved it by:
//imports ad lib...
Set<String> getFieldsOnScreen(FieldScreenScheme fieldScreenScheme, IssueOperation issueOperation) {
CustomFieldManager customFieldManager = ComponentAccessor.getComponent(CustomFieldManager)
Set<String> result = new HashSet<String>()
FieldScreen fieldScreen = fieldScreenScheme.getFieldScreen(issueOperation)
fieldScreen.getTabs().each{FieldScreenTab fieldScreenTab ->
fieldScreenTab.getFieldScreenLayoutItems().each{FieldScreenLayoutItem fieldScreenLayoutItem ->
String fieldId = fieldScreenLayoutItem.getFieldId()
// I am only interested in custom fields - change appropriately
if (fieldId.startsWith("customfield")) {
CustomField customField = customFieldManager.getCustomFieldObject(fieldId)
result.add(customField.getName())
}
}
}
return result
}
Set<String> getFieldsOnScreens(FieldScreenScheme fieldScreenScheme) {
// I am only interested in Edit and View screens - change appropriately
return getFieldsOnScreen(fieldScreenScheme, IssueOperations.EDIT_ISSUE_OPERATION) + getFieldsOnScreen(fieldScreenScheme, IssueOperations.VIEW_ISSUE_OPERATION)
}
IssueTypeScreenSchemeManager issueTypeScreenSchemeManager = ComponentAccessor.getIssueTypeScreenSchemeManager()
IssueTypeScreenScheme issueTypeScreenScheme = issueTypeScreenSchemeManager.getIssueTypeScreenScheme(<My Project>)
FieldScreenScheme fieldScreenScheme = issueTypeScreenScheme.getEffectiveFieldScreenScheme(<My IssueType>)
return getFieldsOnScreens(fieldScreenScheme)
Hi Sune,
the easiest way I saw on this site.
By the way, it does not take care of the "technical" fields hidden in transition screens nor postFunctions.
+1 anyway.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lukas,
I can show you how to get a list of all fields on the screens for a given issue if that helps.
//Sune
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Would you like to share with us this knowledge?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
im asking because i don't know how to get what custom field i have for view screen for specific issue type by groovy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.