You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.