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

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

This widget could not be displayed.
Mizan Community Champion Jun 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;


Thank you Mizan, it works!

Mizan Community Champion Jun 24, 2012

Great :) ...

This widget could not be displayed.

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
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

491 views 3 18
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you