Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,551,899
Community Members
 
Community Events
184
Community Groups

How to retrieve users from a specific group with simple Jira automation rules

If you’re using Jira Service Management, you may find yourself searching for a quick way to find all users who belong to a specific group and apply automations in Jira. You always have an option to add users one by one right to the request for assignment, approvals, or simply as participants, but it may be too time-consuming. There is also a chance that the person you need is off work, and with group automation you have other people being able to pick up the request. Let’s have a look at a couple of usage scenarios and workarounds we’ve elaborated.

Scenario 1: security change approval

 

Though Jira was updated recently, with the feature to use Approval groups added, it still does not cover all user needs. So we came up with the following automation rule to help you use groups in automations faster and easier.

 

Imagine, you need to approve a security change with the Security group before it comes to CAB approval, or you want to receive approval from the Security group for the user requesting antivirus software. To be sure everything goes smoothly, you want to implement a smart approval process in Jira Service Management, and populate all members of a specific group (for example Security group) as approvers.

 

  1. To retrieve group members, send a call into Jira API using the automation web request action:

https://<your_domain>.atlassian.net/rest/api/3/group/member?groupname=<group_ name>

 Picture 11.png

You can find more details on web request authorization here, if you are interested.

 2. Put a response in a variable which can be later used within the automation rule:

 Picture 12.png

3. Now put the groupMembers variable into the Approvers field and:Picture 13.png

Scenario 2: group assignment

Your Jira Service Management requests are assigned to specific groups based on the nature of the request. There are no group assignments out of the box, so we usually use the Assignment group approach. And as soon as the request is assigned to a specific group you want to make sure that the assignee (which is a single-user field in Jira — the user who is responsible for the request) belongs to the Assignment group”\ set in the request.

 

  1. To retrieve all group members you have to send an API call:

 

https://<your_domain>.atlassian.net/rest/api/3/group/member?groupname={{issue.Assignment group}}

2. And then put a response in a variable:

 

members = {{webResponse.body.values.accountId.join("|")}}

 Picture 14.png

 As a result, you have a string variable filled with assignee IDs separated with "|"

 

Having that set, you now can easily check if {{members}} contains {{assigneeId}}

 Picture 15.png

As you’ve set all automation rules, you can now add an action. If your assignee is in the group, then do nothing, but if not, clear the assignee field and leave a comment, or notify someone for extra moderation of the request.

 

And that’s it.

 

Just curious - have you ever faced a challenge like this? If yes, what did you do? Please, share your stories in the comments, and let’s discuss.

2 comments

Hi Alex,

Thank you for the article. 

1. As I can see, the '/group/member' API request is a paginated request, and it's not handled in your example. So, there should be a cycle of REST API calls, interesting use case to implement. For the second scenario, we can use '/user/groups' call instead to avoid using a cycle.

2. I believe there is a typo with {{/}} at the end of the URL in the first screenshot.

Like # people like this

Hi @Andrey Kiyanovsky

 

Thank you for the comment.

 

#1

Yes, you're right. These scenarios are for groups with up to 50 users. The approval groups as a rule don't contain many users. And this automation completely covers all our needs. But, sure if you have a large group you should use a cycle.

I will prepare the additional rule for building the list of approvers in a cycle.

You are right - for the second scenario, we can use '/user/groups' to find user groups and check if the list contains an Assignment group.

#2

Correct, it's a mistype while preparing pictures for the article.

 

Thank you!

Like Andrey Kiyanovsky likes this

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events