Script which results the list of the names of the current projects in Jira

Rumceisz June 19, 2012

Hi All,

I would like to use this script in a scripted custom field. I would like to get a list of the names (notproject keys!) of the current project in our Jira instance.

Another request would be a bit difficult(?): we also need the list of names of the current space names (not personal space!) of our Confluence.

Can you please suggest?

Thanks in advance,

Rumi

2 answers

1 accepted

0 votes
Answer accepted
Mizan
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.
June 19, 2012

Try the below script (taken from the script runner docs) , but i am not sure how it will display the values . were you able to create a simple multiselect field which displays few options in the list ?

import com.atlassian.jira.ComponentManager
 
def projectManager = ComponentManager.getInstance().getProjectManager()
def result="";
for(p in projectManager.projects) {
    result += "$p.name";
}
return result;


Rumceisz June 24, 2012

Thank you Mizan, it works!

Mizan
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.
June 24, 2012

Great :) ...

0 votes
Dennis Kromhout van der Meer
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.
June 19, 2012

I would use the REST API to get all projects accessible for the currently logged in user. For more info, please see the following documentation: http://docs.atlassian.com/jira/REST/latest/#id160865

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events