Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get issue type type object?

Hello, 

I have the following piece of code: 

 

def firstProjectKey = 'ABC'
def getFirstProject = projectManager.getProjectByCurrentKeyIgnoreCase(firstProjectKey)

def firstProjectIssueTypesList2 = itsm.getIssueTypesForProject(getFirstProject)

def issueTypeScreenSchemeManager = ComponentAccessor.getIssueTypeScreenSchemeManager()

for (issueType in firstProjectIssueTypesList2){
log.warn(issueType)
def fieldScreenScheme = issueTypeScreenSchemeFirstProject.getEffectiveFieldScreenScheme(issueType)
}

 

I run this in the console and i get:

groovy.lang.MissingMethodException: No signature of method: java.lang.String.getEffectiveFieldScreenScheme() is applicable for argument types: (com.atlassian.jira.issue.issuetype.IssueTypeImpl) values: [IssueConstantImpl[[GenericEntity:IssueType][sequence,null][name,Project][iconurl,/secure/viewavatar?size=xsmall&avatarId=12315&avatarType=issuetype][description,Issue Type for GLC][style,null][id,10403][avatar,12315]]]
at Script1787.run(Script1787.groovy:204)

 

What is the format that it wants? I saw in:  https://docs.atlassian.com/software/jira/docs/api/7.0.0/com/atlassian/jira/issue/issuetype/class-use/IssueType.html that it expects a "issue type type" .. but how does that look, where to get it from?

 

Thank you!

 

1 answer

1 accepted

Hi @arama mihai,

If you want to get the Issue Type using the ScriptRunner console, you could try something like this:-

import com.atlassian.jira.component.ComponentAccessor

def issueManager = ComponentAccessor.issueManager
def issue = issueManager.getIssueByCurrentKey("MOCK-44")
log.warn "====>>> ${issue.issueType.name}"

 Please note, this sample code is not 100% exact to your environment. Hence, you will need to make the required modifications.

Below is a print screen of the console for your reference:-

console1.png

I hope this helps to solve your question :)

 

Thank you and Kind Regards,

Ram

Hi @Ram Kumar Aravindakshan _Adaptavist_ ,

 

Thank you very much for your reply! I am, however, trying to get the screen scheme out of a issue type screen scheme, and I am not using any issues. I used :

def issueTypeScreenSchemeManager = ComponentAccessor.getIssueTypeScreenSchemeManager()
def issueTypeScreenSchemeFirstProject = issueTypeScreenSchemeManager.getIssueTypeScreenScheme(getFirstProject).name

to get the project's issue type screen scheme.

Now, I want to get the screen schemes that are part of this issue type screen scheme, and their association to each issue type.

Would this be possible?

 

Thank you!

Hi @arama mihai

For your requirement, you could try something like this:-

import com.atlassian.jira.component.ComponentAccessor

def schemeManager = ComponentAccessor.issueTypeScreenSchemeManager
def projectManager = ComponentAccessor.projectManager
def projectObjects = projectManager.projectObjects
def builder = new StringBuilder()

projectObjects.each{

it.issueTypes.each{ issuetype->

if(it.key == "MOCK") {

def issueTypeScreenScheme = schemeManager.getIssueTypeScreenScheme(it)

builder.append("\nProject Name: ${it.name}, \t Issue Type: ${issuetype.name},\t Issue Type Screen Scheme: ${issueTypeScreenScheme.name}\n")
}

}
}
log.warn builder.toString()

Please note, this sample code is not 100% exact to your environment. Hence, you will need to make the required modifications.

Below is a print screen of the code along with the output:-

console2.png

I hope this helps to solve your question :)

 

Thank you and Kind Regards,

Ram

Like arama mihai likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

131 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you