Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Screen Schemes Manager class with Scriptrunner returns unassigned schemes

Marko Slijepčević July 30, 2024

Hi everyone,

I'm working on a script to fetch custom fields in a project, and I started to do this by fetching the Issue Type Screen Scheme first, when I noticed that the Issue Type Screen Scheme Manager class returned some Screen Schemes that are not assigned to the project at all.
Below is a code snip that represents the situation clearly:

My Code: 

import com.atlassian.jira.component.ComponentAccessor
import
com.atlassian.jira.project.Project
import groovy.xml.MarkupBuilder

def projectManager = ComponentAccessor.projectManager
def issueTypeScreenSchemeManager = ComponentAccessor.getIssueTypeScreenSchemeManager()

def writer = new StringWriter()
def markup = new MarkupBuilder(writer)

def baseProject = Projects.getByKey("C2C")
def sourceIssueTypeScreenScheme = issueTypeScreenSchemeManager.getIssueTypeScreenScheme(baseProject)

markup.h1(sourceIssueTypeScreenScheme.getName())

sourceIssueTypeScreenScheme.getEntities().each {

    def sourceScreenScheme = it.getFieldScreenScheme()

        markup.p("-- sourceScreenScheme: ${sourceScreenScheme.getName()}")

 }

writer.toString()
My Output:
out.png
Actual setup
actual.png

Does anyone have an idea why this happens?
It is mostly that the output returns Xray's schemes, but on some projects that I tested I got some regular schemes as well. I tried to clear my browser cache as well, but the problem persisted.

Thank you!

1 answer

0 votes
Ramin Shanehsaz _Computerra_
Atlassian Partner
August 6, 2024

The screenshot does not show the actual issue type screen scheme but lists only the screen schemes for the issue types that are configured in your specific project.

So, the issue type screen scheme includes more screen schemes for some issue types (probably some Xray testing issue types), that are not shown in the project configuration, since the issue types are not active in that project.

To check the "real" configuration of your issue type screen scheme go to the global administration:
cog icon -> Issues -> Issue Type Screen Schemes -> '[SP] Standard Issue Type Screen Scheme 1.0' -> Configure

Best,
Ramin

Suggest an answer

Log in or Sign up to answer