Here at Isos Technology, we've seen use cases for pretty much everything. One use case that has come up for both my clients and myself as an admin has been identifying which screen schemes are associated with a specific issue type across the instance.
Say you want to deprecate an issue type or do some other form of analysis on its usage. If you go to the analyze the issue types in the admin UI of Jira, it will only show you the related issue type schemes for each issue type, so you can't really gain any useful information on which screen schemes are associated with the issue type from the UI.
So, in this blog post, I will show you how to quickly identify all screen schemes associated with an issue type across your Jira instance using a simple groovy script! To run it, just pull up a Groovy console in Jira (note that a Groovy console comes with some typical apps like JMWE and may not be available out-of-the-box).
Let's jump right in:
As you can see from the above, lines 6 and 7 are the only places you need to edit the above script to gather the needed information. Enter the issue type ID for the issue type you are searching for, as well as the name. What the script does is iterate over all projects to see which projects use the issue type. Then, for projects that use the issue type we iterate over the issue type screen scheme entities to find which screen schemes map to the issue type. If we find it, great – we add it to the results.
One caveat is that if our issue type is associated with the default screen scheme within the mapping (i.e., the issue type screen scheme), the API will not return the issue ID...it returns null. So if we happen to not find a specific mapping of the screen scheme for your issue type, we run back through to grab the default since, by default (haha, see what I did there), it is the screen scheme that will be used for your issue type.
After our code finds all the screen schemes associated your specified issue type, we remove any duplicates from our list and output it to the console. Here is an example of output from my script above:
Screen schemes found:
And voilà! It is as simple as that! I hope these script snippets can help speed your admin tasks or client needs along. And as always, happy automating!