Forums

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

How to identify Xray is enabled for jira Project

Jyoti Kumari
Contributor
March 8, 2024

Hello Everyone,

 

I would like to know, how to identify Xray is enabled for  specific jira Project through script runner or Rest API, or any other ways to find it programatically.

Thanks and Regards,

Jyoti

1 answer

1 accepted

1 vote
Answer accepted
Florian Bonniec
Community Champion
March 8, 2024

Hi @Jyoti Kumari 

 

A project using Xray is the porject that have the Xray issue type available. You can find them using the following script.

import com.atlassian.jira.component.ComponentAccessor

def projectManager = ComponentAccessor.projectManager

def issueTypeManager = ComponentAccessor.getIssueTypeSchemeManager()

// Define the issue type name you want to search for

def targetIssueTypeName = ["Test", "Test Set", "Test Plan", "Test Execution"]

// Get all projects

def allProjects = projectManager.getProjectObjects()

List<String> xrayProject = new ArrayList<String>()

// Iterate through each project

allProjects.each { project ->

    // Get issue types for the project

    def issueTypesForProject = issueTypeManager.getIssueTypesForProject(project)

    // Check if the target issue type exists in the project

    if (issueTypesForProject.find { it.name in targetIssueTypeName }) {

        xrayProject.add(project.key)

    }

}

return xrayProject

Regards

Jyoti Kumari
Contributor
March 10, 2024

Hello @Florian Bonniec 

 

These approach will not work for my scenario, as issue type is showing to the projects in which Xray is disabled, because all these project area is using same Issue type scheme.Kindly guide me ,how these can be achievable.Manually we are able to identify it from Project's setting Action Menu options.

 

Thanks and Regards,

Jyoti

Florian Bonniec
Community Champion
March 11, 2024

@Jyoti Kumari 

 

Oh you not looking to project that have Xray features but Projects that are configured as Requirement projects with the Xray Requirement Coverage right ?

 

You want to find project listed in this config page ?

 

/secure/admin/views/XrayRequirementProjectsConfiguration.jspa

 

You can use the following endpoint

 

https://docs.getxray.app/display/XRAY/Integration+with+ScriptRunner#IntegrationwithScriptRunner-Obtainingallprojectswithrequirementcoverageenabled

 

Regards

Jyoti Kumari
Contributor
March 11, 2024

Hello @Florian Bonniec ,

 

Thank you so much, it is really helpful.

 

Best Regards,

Jyoti

 

Suggest an answer

Log in or Sign up to answer