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
I am attempting to run a script in Power Groovy - Script Launcher that will Delete Screen Schemes not used by any Issue Type Screen Schemes:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.screen.FieldScreenSchemeManager
def fssm = ComponentAccessor.getComponent(FieldScreenSchemeManager.class)
def itssm = ComponentAccessor.issueTypeScreenSchemeManager
def sb = new StringBuffer()
sb.append("Deleted screen schemes with no associated issue type screen schemes:\n")
fssm.fieldScreenSchemes.each { fss ->
try {
def itssCollection = itssm.getIssueTypeScreenSchemes(fss);
// find field screen schemes that are still associated with deleted issues type screen schemes
def allDeleted = true;
itssCollection.each { itss ->
if(itss != null) {
allDeleted = false;
return;
}
}
//remove field screen schemes with no (valid) associated issue type screen schemes
if(itssCollection.size() == 0 || allDeleted == true) {
//remove association to any screens
fssm.removeFieldSchemeItems(fss);
//remove field screen scheme
fssm.removeFieldScreenScheme(fss);
sb.append("${fss.name}\n");
}
}
catch(Exception e) {
//noop
sb.append("Error: " + e + "\n");
}
}
return "<pre>" + sb.toString() + "<pre>"
When attempting to run this script, I am getting the following error:
startup failed: Script1.groovy: 2: unable to resolve class com.atlassian.jira.issue.fields.screen.FieldScreenSchemeManager @ line 2, column 1. import com.atlassian.jira.issue.fields.screen.FieldScreenSchemeManager ^ 1 error
Looking into all the documentation that I can, I find that FieldSCreenSchemeManager is listed as an interface in the support documentation and is not deprecated anywhere that I can tell. Even in the latest 9.0.0 Jira documentation:
Package com.atlassian.jira.issue.fields.screen documentation has an interface for FieldScreenSchemeManager:
ComponentAccessor documentation also has FieldScreenSchemeManager:
So my question is, why is this not able to resolve this class/interface?
Hm, strange indeed.
Copy pasting your snippet and adding the getter both resolve the same object on 8.20.8:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.screen.FieldScreenSchemeManager
def fssm = ComponentAccessor.getComponent(FieldScreenSchemeManager.class)
def fssm2 = ComponentAccessor.getFieldScreenSchemeManager()
return fssm.toString() + "<br>" + fssm2.toString()
Result
com.atlassian.jira.issue.fields.screen.DefaultFieldScreenSchemeManager@1ec1cd1
com.atlassian.jira.issue.fields.screen.DefaultFieldScreenSchemeManager@1ec1cd1
Is this something persisting even after restarting Jira, and which version are you on?
Hello Radek,
We are currently on Version 8.18.2. I am not an admin user on my device nor do I have access to the server that our Jira instance is hosted on, if you are referring to starting/stopping the whole Jira instance, so that isn't something I have tried yet...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Radek,
We are currently on Version 8.18.2. I am not an admin user on my device nor do I have access to the server that our Jira instance is hosted on, if you are referring to starting/stopping the whole Jira instance, so that isn't something I have tried yet...
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.