Get list of issuetypes for project in Scriptrunner

Mohit Dhir September 9, 2018

Hi,

I am making a script which will loop through all the projects one by one and create an issue (Story) in each project and link it to an epic. This needs to be executed one every quater (in night). 

I am now stuck with one thought that the script is failing for the projects which does not have the Story in their issue type scheme and hence want to ammend my script to handle this.

I am thinking if possible to have a check, if Story exist in the Issue type for the project then proceed else find the other issue types available in the project and create the issue with one of the available issue type.

 

Could you please assist me in how can I get the list of available/mapped issue types for a project. I have done some searching and got the process to find all the issue types in system but have not found anything to get it for a project.

 

I am using script runner and having fairly less experience in groovy. a small snippet really would help

1 answer

1 vote
Prakhar Srivastav {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 9, 2018

@Mohit Dhir

If you have instance of Project then you can just call getIssueTypes() , to get all the issue type for the project.

 

https://docs.atlassian.com/software/jira/docs/api/7.2.0/com/atlassian/jira/project/Project.html#getIssueTypes--

 

 

Regards

Prakhar

Mohit Dhir September 10, 2018

Thanks for your comment.

Yes I do have the project objects. I am not sure why it was difficult for me to find this. I tried alot of time to search but did not get the relevant part for the project.

Your suggestion is working for me. Thanks for this. 

Suggest an answer

Log in or Sign up to answer