Get all JIRA User Group names for a Project using Jelly

I need to get all the JIRA Groups that are members of a JIRA project using Jelly.

I can get the actual users GetProjectRoleActors. This also gives the users that are part of the group. But how can I get the Group name?

3 answers

1 accepted

This will do the trick:

<JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib" xmlns:core="jelly:core">
    <jira:GetProjectRoleActors projectkey="ABC" projectroleid="10001" var="roleactors" >
        <core:invoke on="${roleactors}" method="getRoleActorsByType" var="groups">
            <core:arg type="java.lang.String" value="atlassian-group-role-actor" />
        </core:invoke>
        <core:forEach var="actor" items="${groups}">
            ${actor.group.name}
        </core:forEach>
    </jira:GetProjectRoleActors>
</JiraJelly>

Of course, you'll need to specify your own project key in place of my 'ABC', and you'll need to use the correct projectroleid in place of my '10001'.

David,

Is there a similar way of getting just the Users in a particular role and getting their User Ids. I am trying the below script, I get the users but they are in the form of [user1:1] How can I get just the user name? I tried actor.users.name, actors.users.id.

<jira:GetProjectRoleActors projectkey="ABC" projectroleid="10002" var="roleactors" >
	<core:invoke on="${roleactors}" method="getRoleActorsByType" var="usernames">
		<core:arg type="java.lang.String" value="atlassian-user-role-actor" />
	</core:invoke>
	<core:forEach var="actor" items="${usernames}">
		Testing: ${actor.users}
	</core:forEach>
</jira:GetProjectRoleActors>



Perfect! Thanks

To get users you need to do the second loop because {actor.getUsers()} is a Set.

<core:invoke on="${roleactors}" method="getRoleActorsByType" var="users">
  <core:arg type="java.lang.String" value="atlassian-user-role-actor" />
</core:invoke>

 <core:forEach var="actor" items="${users}">
   <core:forEach var="user" items="${actor.getUsers()}">
     Name: ${user.getName()}, Display Name: ${user.getDisplayName()}, Email: ${user.getEmailAddress()}
  </core:forEach>
</core:forEach>

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,958 views 12 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot