In a self-service we want the users to be able to request who the space admin of a jira (and soon also confluence) space is. Users created a SR where they enter the project key as text input.
Main Goal of Automation: List all admins of a space, but exclude app users and site admins.
A list of all admins is available via API call, the user type is simply an attribute. Site admins are listed seperately and therefore need another API call.
Since we have Jira Enterprise available, I used advanced components for the automation.
The automation follows the logic:
- send web request to rest/api/3/user/permission/search?projectKey={{issue.summary}}&permissions=PROJECT_ADMIN to get all project admins in a certain space
- branch over all returned admins: inside the branch we apply two filter
{{adminUser}} is hereby defined as: {{webResponse.body}}
The answer we get is something like this:
{self=https://api.atlassian.com/ex/jira/<cloudId>/rest/api/3/user?accountId=<id>, accountId=<id>, accountType=app, emailAddress=, avatarUrls={48x48=…, 24x24=…, 16x16=…, 32x32=…, displayName=<accountName>, Charts, and Dashboards, active=true, timeZone=Europe/Berlin, locale=en_US}
We care about the accountType, accoundId and displayName.
The API requesting a users group returns a list of all groupNames the certain user is a member of.
groupNames is hearby defined as Smart value: {{#webResponse.body}}{{name}},{{/}}
Here you can see, that I tried storing the admins, that we want to return to the user in a custom field (user-picker). But it did not work. Thats just one way we tried.
The problem is, that want to return all valid admins in one comment to the customer in the end.
We tried several ways of "storing" the valid admins like in a custom user-picker field or in a variable. But there is always the same problem: as branch executions run in parallel, the values frequently overwrite each other, so that in the end not all admins are stored. Even in small tests we sometimes only end up with 2 out of 3 admins saved, although the audit log correctly shows that all admins were processed.
The technical question is basically: How can I filter the first list to remove all entries that also appear in the second list (and exclude app users based on a specific attribute)?
Is there any reliable way in Jira automation to aggregate results from a branch without overwriting each other? Do you have an idea? Maybe a high complex concatting of JSONs?
Thanks a lot :)
Hi @Carlotta May -- Welcome to the Atlassian Community!
Without seeing your entire rule and audit log details, and the what is the purpose / "why do this" for the rule, to provide context...
As you note, branches which could be on more-than-one-thing process in parallel and asynchronously. Thus, branches cannot accumulate results for such cases. Possible workarounds depend upon the scenario to be solved. For example:
Kind regards,
Bill
Hey @Bill Sheboy ,
thanks for your answer. I updated my question and provided screenshots of the whole workflow and added some additional information. I hope the problem and the reason behind it are a little clearer now.
Its basically like this: I have a list of all space admins from an API. Additionally, there is a list of site admins available via another API. How can I filter the first list of admins to remove all entries that also appear in the second list for site-admins?
Best regards
Carlotta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the additional information, @Carlotta May
Based on your scenario / steps description, you could try the techniques I describe in this article to find overlaps between two lists...noting the variations at the bottom of the article for removing overlapping values.
The steps outline might be:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Carlotta May
Welcome to the Atlassian community.
Can you share the details of your For Each branch step configurations?
Have you tried writing the values to a text or paragraph field in the issue, appending each value as you loop through the branch? After the branch you could add a step to then create a comment including the content from that field, then clear the field after creating the comment. You might have to put a Delay step after the branch and before the Comment action to ensure the branch has time to complete before the comment is created.
I'm just brainstorming. I have not tested this idea.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Trudy Claspill
thanks for your brainstorming!
My for each branch is defined like this:
I tried to store the admin names in the description field of the issue, but there was the same problem with overwriting as the edit work item actions may work in parallel. :/
I also did re-fetchs befor each and delays before commenting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.