Forums

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

How to append multiple values in multi user custom field using BRANCHES ?

IT Brute November 27, 2025

We are on Jira Cloud. 

OBJECTIVE: To retrieve the account id from the display names and update custom field. 

USE CASE: When a user mentions another user(s) in an email reply to a work item these user names show as display names in Jira.  I have an automation rule that filters out the display names, constructs email address. Then I use API call in Branches to get account ID for each email address. 

MAIN ISSUE: Issue here is that in branching the custom field is not being edited because, as per my understanding, the variable in which account ID is stored resets each time values is added to it. 

METHOD 1 (partially successful): USE SEND WEB REQUEST ACTION FOR EACH EMAIL ADDRESS TO RETRIEVE ACCOUNT IDs
I used Advanced Branching. For each email address API GET call is made to retrieve the account ID. AccountID is stored in a variable. JSON is used to update the custom field. JSON is stored in a variable and EDIT Action  with Advanced Editing that contains the JSON variable. This ofcourse, doesn't work

Here are the complete steps followed by screenshots: 

 1. Trigger -> All Comments - Rule is run when a new comment is added to a work item

2. Create variable getDisplayNames filters the mentioned display names from the comment

Smart Value: {{comment.body.match("@(\\S+\\s\\w+)")}}

3. Create variable varEmailAdrs constructs email address from display names

 Smart Value: {{getDisplayNames.split(",").trim().join("@domain.com,").replace(" ", ".")}}@domain.com

4. BRANCH
4.1 Create variable varEmailAdrsSplit splits the varEmailAdrs by comma (",")
Smart Value: {{varEmailAdrs.split(",")}}

4.2 SEND WEB RQUEST action 
<API URL>/user/search?query={{varEmailAdrsSplit.urlEncode}}

4.3 Create variable apiResponseAccountId to retrieve the account ID 
Smart Value: {{webResponse.body.first.accountid}}

4.4 Create Variable varJson  value:
{ "update": { "customfield_10610": [ { "add": [ { "accountId": "{{apiResponseAccountId.trim()}}" } ] } ] } }

4.4 Edit Work Item, Advanced Editing {{varJson}}

I have no issues else where. API request is successful, the Audit Log shows "success". Just need to append the account IDs to custom field that is all!
Snipaste_2025-11-27_15-45-58.pngSnipaste_2025-11-27_15-47-48.png

Thanks! 


2 answers

1 vote
Bill Sheboy
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 Leaders.
November 27, 2025

Hi @IT Brute 

Are you using Jira Cloud or Server / Data Center version?

And, are the people "mentioned" Jira users?

 

For Jira Cloud, user mentions in the comments contain the accountId values, and those could be used directly to create a dynamic JSON expression to update a multiple-selection user field in a single edit without any branching.

Or, do you mean someone is adding comments with email addresses rather than mentioning people using the built-in mention feature?

 

Kind regards,
Bill

IT Brute November 27, 2025

@Bill Sheboy  these are display names and not user names. Display names are just text strings. I have another automation rule where I achieve the same because users mentioned are user names. 

We are on Jira cloud.

Bill Sheboy
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 Leaders.
November 28, 2025

Would you please confirm how the mentions are entered in the comment?  How are displayNames being entered as mentions?

 

For example, when one types @ followed by a Jira user's name, that is stored in the comment markup for a mention like this:

[~accountId:{{user selected.accountId}}]

Where an example from checking a specific {{comment.body}} could be:

[~accountId:557057:1d4fd7f4-bbac-4466-82ee-aaabbbccc]

In the UX, the user's displayName shows, but parsing the comment body should return the accountId value.

 

IT Brute November 28, 2025

@Bill Sheboy The issue is when the user doesn't use Jira's UI to add the user names. 
'accountId' only comes in if the users are mentioned using Jira's portal. Mentioned below are two screenshots, one shows the reply from Outlook, the second shows comment mark up
The users mentioned in the comments are "TestUser 2" and "TestUser 3" 
Snipaste_2025-11-28_11-06-30.png
Snipaste_2025-11-28_10-59-33.png

Bill Sheboy
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 Leaders.
November 28, 2025

Thanks for that information, @IT Brute as it helps narrow down a possible workaround...

There are no bulk-get / search users by email addresses since the GDPR changes released a few years ago.  And, after some quick experimentation, I could not find an endpoint which successfully returned multiple accountId values for a list of email addresses.

As you appear to be on a Premium license level, I hypothesize you have a larger number of users in the product, thus hardcoding is not an option for a rule.

 

One possible workaround is a using a recursive, multiple-rule approach, although it can be a brittle solution.

  • first rule
    • use your current rule to extract any email addresses
    • pass that list, and any other information, to the second rule, calling it with Send Web Request
  • second rule
    • with an Incoming Webhook trigger, receive the data
    • get the accountId as you do today with Send Web Request and the REST API
    • edit the work item to add the user with a JSON expression
    • remove the email address from the list, and when there are more to process...
    • recursively trigger this same rule again, passing the remaining email addresses, with Send Web Request

This approach will work for up to 10 email addresses, before the looping service limit happens.

 

If you can write / host your own service, a better workaround may be to write an app which can sequentially process the email addresses, and then just call that with Send Web Request.

Like Marc -Devoteam- likes this
0 votes
Marc -Devoteam-
Community Champion
November 28, 2025

HI @IT Brute 

What are the details of your edit action?

IT Brute November 28, 2025

@Marc -Devoteam- Audit Log shows the "Issues edited successfully" but it clearly hasn't been, because the user names are not in the custom field. Screenshot below:Snipaste_2025-11-28_08-12-36.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events