Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Automation: Merge accountIds from Project Roles and notify only active users

Raissa Nepomuceno Epaminondas
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 11, 2026

Hi everyone,

I’m trying to implement a Jira Cloud Automation rule to notify leadership users when the percentage of Bugs in the backlog exceeds a threshold.

The email recipients must be dynamically retrieved from Project Roles.

Main Requirement

The automation must:

  • Retrieve users from multiple Project Roles

  • Merge all returned accountIds into a single list

  • Remove duplicated users

  • Validate which users are ACTIVE

  • Retrieve email addresses only for ACTIVE users

  • Send emails only to ACTIVE users

  • If ALL users are inactive, send email to a fallback user


Current Automation Logic

What I tried so far:

GET Role PO (/rest/api/3/project/{{project.id}}/role/12067)
↓
GET Role SM (/rest/api/3/project/{{project.id}}/role/12064)
↓
Advanced Branch:
{{webResponses.body.actors.actorUser.accountId}}
↓
GET Admin API (https://api.atlassian.com/admin/v2/orgs/{orgId}/directories/{directoryId}/users/{{getAccountId}})
↓
Condition:
{{webResponse.body.data.status}}
↓
Send Email:
{{webResponse.body.data.email}}
ELSE
Send email to fallback user

Unfortunately, this is not working correctly.

Inside the Advanced Branch, {{getAccountId}} is coming empty in my environment.

Because of that, the Admin API request becomes:

/users/

instead of:

/users/{{accountId}}

which causes the API to return the first page of users from User Management.

After investigating with Atlassian Support, I now understand why this behavior happens.


Additional Attempts

I also tested:

{{ActorsAccountIdPO.concat(ActorsAccountIdSM)}}

but the variables seem to behave like strings instead of arrays.

Result example:

[id1][id2],[id3]

instead of a proper merged list.

I also tried a simpler merge approach:

{{accountIdPO}},{{accountIdSM}}

This worked partially for iteration purposes, but:

  • I could not identify a reliable way to remove duplicated users

  • the array/string behavior in Jira Automation seems inconsistent

The most stable workaround I found so far was:

{{allAccountIds.split(",").removeEmpty().distinct()}}

Important Constraint

I cannot use:

/rest/api/3/user?accountId={{getAccountId}}

because in our Jira Cloud environment the emailAddress field is NOT returned due to privacy restrictions.

Because of this, I had to use the Admin API instead:

https://api.atlassian.com/admin/v2/orgs/{orgId}/directories/{directoryId}/users/{{getAccountId}}

since this endpoint returns:

  • email

  • active/inactive status


Main Question

Is it actually possible to implement this logic reliably using only Jira Automation Cloud?

More specifically:

  • What is the best pattern to merge accountIds from multiple Project Role requests?

  • How can duplicated users be removed safely?

  • What is the best approach to validate only ACTIVE users?

  • How would you implement the fallback logic if ALL users are inactive?

Or would you recommend another approach instead, such as:

  • Forge

  • External API/service

Any guidance or architecture suggestions would be greatly appreciated.

Thanks!

2 answers

0 votes
Pablo Vergara
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 Champions.
May 13, 2026

Hi @Raissa Nepomuceno Epaminondas 

Welcome to the community forums!

This was quite an interesting and challenging scenario. I wasn't able to find an out-of-the-box solution without using REST API requests with Automation for Jira, so that the approach will use a few different endpoints.

My tested configuration example is shown in the captures below. Just consider the proposed solution uses a single project role, but that can be changed later on if needed, adding new variables and a final one to compound all the extracted members' account IDs.

I hope this helps you as a guideline!

1.png

2.png

- Pablo Vergara / SSE - ServiceRocket

0 votes
Marcos Sanchez
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 Champions.
May 13, 2026

Hello @Raissa Nepomuceno Epaminondas

As far as I can see on a first look, getAccountId is empty because you are retrieving

{{webResponses.body.actors.actorUser.accountId}}

instead of 

{{webResponse.body.actors.actorUser.accountId}}

the API call on the automation returns webResponse, without the 's'. In fact, I can see that you are properly using it on the rest of the flow, so it should work as expected then.

On the other hand, I'm not 100% sure that Automation for Jira maybe can't do that data process that you require. Specially the status checks and the deduplication.

If you are familiar with Forge, a small Forge app would fit greatly. If not, maybe you could develop some Python script on a Jenkins job or similar and run it as a service.

Regards!

Raissa Nepomuceno Epaminondas
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 13, 2026

Hello @Marcos Sanchez !

However, because I needed to merge the results from both Project Role requests, Atlassian Support recommended using webResponses (with “s”) to access all previous web request responses together inside the same rule and webResponses.body is actually returning data correctly from both requests.

I added a Log Action with:

webResponses Body: {{webResponses.body}}

Screenshot 2026-05-13 at 15.46.11.pngScreenshot 2026-05-13 at 15.39.46.png 

So at this point I believe the challenge is more related to how Jira Automation handles array parsing / iteration from merged webResponses rather than the API response itself.

Screenshot 2026-05-13 at 16.12.17.pngScreenshot 2026-05-13 at 16.09.36.png

I also agree with your point that Automation may not be the ideal tool for this level of data processing and deduplication logic. :/ 

 

Thanks a lot for your help and insights!

 

Suggest an answer

Log in or Sign up to answer