Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,702
Community Members
 
Community Events
184
Community Groups

A scripted way, to get all edit screens.

My goal is: I want to get all screens, that are in use as "Edit screens". 

Since it would be a lot of clicking around, to go through all projects, into the project settings, on the screens section, and check all schemes, and since I want to get a bit practice, I want to write a script to do the job. 

So far I can read all projects, I can read the Issue type screen scheme for each project, and the Screen schemes, that are configured for each Issue type within the Issue type screen scheme. But I cannot read the Edit screen, that is configured in a Screen scheme. 

Here is the code I have so far:

{code}

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.project.Project
import com.atlassian.jira.issue.operation.IssueOperationImpl

List<Project> probs = ComponentAccessor.getProjectManager().projectObjects

probs.each{ prob ->
    def itss = ComponentAccessor.getIssueTypeScreenSchemeManager().getIssueTypeScreenScheme(prob)
    log.warn("Issue type screen scheme entities for: ${itss.getName()}")

    log.warn("Entities:")
    itss.getEntities().each{ entity ->
        log.warn("${entity.getIssueType()?.getName()} - ${entity.getFieldScreenScheme().getName()}")
    }

}

{code}

What I found :

When I have a Screen scheme, and I want to read the Edit screen, there is a method: FieldScreen getFieldScreen(IssueOperation issueOperation ) 

But I don't know how to provide that parameter "IssueOperation". It's not a string or an enum, it's an Object, I can create such an Object, but it's not giving the expected result.

E.g.:

itss.getEntities()[0].getFieldScreenScheme().getFieldScreen(new IssueOperationImpl("Edit Issue",""))
Is giving me the Create screen. 

 

I'm afraid, this is very specific, but any help is much appreciated. 

 

1 answer

1 accepted

1 vote
Answer accepted
Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 11, 2023

Hi @Milan B 

I do not have much time to investigate to make it work with IssueOperationImpl BUT below a script that go through all Screen Scheme and return screen in Edit Operation.

 

import com.atlassian.jira.component.ComponentAccessor

def fieldScreenManager = ComponentAccessor.getFieldScreenManager()
def fieldScreenSchemeManager = ComponentAccessor.getFieldScreenSchemeManager()
fieldScreenSchemeManager.getFieldScreenSchemes().each{ screenScheme ->
    screenScheme.getFieldScreenSchemeItems().each{
        if(it.getIssueOperationName().toString() in ['admin.issue.operations.edit']){
            log.error it.getFieldScreen().getName()
        }
    }
}

Thank you, it works perfect :-)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events