Hi Jira People,
I have the following problem which I hope you can help me with.
I would like to create an automation that basically does 2 things:
1. when the comment is added to the issue, the automation checks if there are any users mentioned there.
2. if a single or multiple users are mentioned, every single one of them is added to CC field.
Why such automation? I've employed Issue Security Scheme based on that field. As many times my users are mentioning users in the comment rather than putting them in CC field I would like to automate this process so that everyone is notified when someone mentions them (also they don't really see the issue before they're added to the CC field)
Now I've been partially successful as I did manage to create and automation which is capable of checking if there is any user mentioned in the comment. The problem is, if there is more than one user mentioned, the automation adds just one, not all of them.
My current partially working setup is this:
The trigger is simple: When: Issue Commented

Then I'm checking if the body of the last comment contains mentions

Then I'm branching out with Advanced branching

and for Smart Value
{{issue.comments.last.body.match("(\[~accountid:(.*?)\])").remove("[~accountid:").remove("]").asJsonObject("id")}}I create a Variable smartUsers
Then Edit issue fields

{ "update": { "CC" : [ { "add": {{smartUsers}} } ] } }
I also added

and in the audit log I can see multiple user IDs, however the CC field is populated with just one and it's driving me crazy. Please help!