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!
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:-
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:-
I hope this helps to solve your question :)
Thank you and Kind Regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.