Forums

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

Automatically adding users mentioned in comment to multiple-user picker field

Jane D_ August 26, 2025

Hello! 
I hope you can help me. I really don't know what I'm doing wrong.

My use case:
Everytime users are mentioned in a comment, I want to add them to the field "Shared With" (multi-user picker).

So first a list of matches in the comment is generated.
Then the list is iterated using advanced branching.
For every match the issue is supposed to be updated by adding a value to the Shared With field.

The rule works fine for the first occurrence of an account id in a comment.
But for the second one it says "specify a valid value for the field".

 

1 answer

0 votes
Jane D_ August 26, 2025

To give more context here are screenshots of the exact rule steps and the audit log

autom1.png

autom2.pngautom3.pngautom4.pngautom5.png

Marc - Devoteam
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.
August 26, 2025

Hi @Jane D_ 

Welcome to the community.

Check this KB, update-values-in-multiuser-picker-field-using-automation-in-jira-cloud 

There is no need to branch.

Like Bill Sheboy likes this
Jane D_ August 27, 2025

Thank you very much!!
Now I'm encountering a different problem - I followed the exact syntax given in the link.

I get the error "Error while parsing additional fields. Not valid JSON."
I tried enclosing the account id to be added in extra brackets. But then I got "Specify a valid value for customfield..."

See pictures for both rule setup and audit log.


Screenshot 2025-08-27 100149.pngScreenshot 2025-08-27 100011.png
Screenshot 2025-08-27 121909.png

Marc - Devoteam
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.
August 27, 2025

Hi @Jane D_ 

The JSON should be one string for the part (no carriage returns in this code, other wise it is seen as an additional rule):


{{#useraccountIDs.split(",")}}{"add": {"id":{{.}}}}{{^last}},{{/}}{{/}}

Jane D_ August 27, 2025

Very useful info! I tried no carriage returns in the part you mentioned. And I tried to remove ALL carriage returns. But it still says "Not valid JSON". 


This is the exact JSON:

{"update": {"customfield_10047": [{{#accountIDs.split(",")}}{"add": {"id":{{.}}}}{{^last}},{{/}}{{/}}]} }


Screenshot 2025-08-27 144218.pngScreenshot 2025-08-27 144151.png

 

Marc - Devoteam
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.
August 27, 2025

Hi @Jane D_ 

I meant only the part from the customfield needs to be one line.

Codeneeds to be:

{"update": {
"customfield_10047": [
{{#useraccountIDs.split(",")}}{"add": {"id":{{.}}}}{{^last}},{{/}}{{/}}
]
}
}

Jane D_ August 27, 2025

I'm so sorry this is so cumbersome. 

 

I took your exact same syntax. 

 

I did 2 things (pics of both attached).


* My variable name is different from that in your code and I first forgot to adjust it. This generated an error "not the right format for updating a field", which was to be expected because the variable I want to iterate does not exist or is empty. My bad.

 

* Then, I adjusted the variable name correctly. I got this freaking "not valid JSON" error again.

 

The variable is definitely not empty (I added pictures again), and should be of the correct type (string list converted to array using split() function in the iterator). 

It must be something about the formatting or characters in the JSON somehow, that's my only guess... Screenshot 2025-08-28 083351.pngScreenshot 2025-08-28 083252.pngScreenshot 2025-08-28 082603.pngScreenshot 2025-08-28 081819.png
 

Marc - Devoteam
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.
August 28, 2025

Hi @Jane D_ 

It could be my error.

Can you try the JSON:

{"update": {
"customfield_10047": [
{{#}}{"add": {"id":"{{accountIDs}"}}}{{^last}},{{/}}{{/}}
]
}
}

Jane D_ August 28, 2025

"Token is empty"

Screenshot 2025-08-28 102600.png

Marc - Devoteam
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.
August 28, 2025

Hi @Jane D_ 

This should be the correct JSON according to the KB

{"update": {
"customfield_10047": [
{{#useraccountIDs.split(",")}}{"add": {"id":{{.}}}}{{^last}},{{/}}{{/}}
]
}
}

But as this doesn't seem to work, might be worth contacting Atlassian Support

 

Jane D_ August 28, 2025

Thank you, Marc. I'll raise a support ticket to hopefully resolve the matter. I'll keep this ticket updated when I have a solution.

Like Marc - Devoteam likes this
Jane D_ August 29, 2025

I have a solution!

The documentation is indeed not quite correct!
The code needs to be:

{"update": {
"customfield_10047": [
{{#accountIDs.split(",").trim()}}{"add": { "id":"{{.}}"}}{{^last}},{{/}}{{/}}
]
}
}

The element in question needs to be put in additional quotes.
(And the support dev also added a trim() call which cannot hurt I guess)

Like Marc - Devoteam likes this

Suggest an answer

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

Atlassian Community Events