Auto add user(s) to the Request Participant field when the user(s) is/are mentioned in a comment
Asked by Tran Ngoc Duc:

Hello, Can anyone advise how to configure the automation to add multiple users to the Request Participants field when they are mentioned in a comment by any one?

Our setting: We configured a Security Scheme that restrict user's access to the ticket. In details, only the following users can access and view the ticket

- Admin

- Reporter

- Approver

- Executor

- Request Participant

This leads to an issue that if the Executor needs someone else's help to proceed the ticket, they will mention that person(s) in a comment. And then the Admin has to add the mentioned person to the Executor or Participant manually, so that mentioned user(s) will be able to access the ticket, read comments.

Therefore, I want to configure an automation that add any users who are mentioned in a comment. I have found this article and tried Scenario 6 but it does not work

<https://confluence.atlassian.com/automationkb/automation-for-jira-how-to-update-the-request-participants-or-a-multi-user-picker-field-from-the-content-of-other-fields-1216971334.html#AutomationforJiraHowtoupdatetheRequestParticipantsoramultiuserpickerfieldfromthecontentofotherfields-Scenario6-AdduserstotheRequestParticipantsfieldfromacommentswhereuserswerementioned>


Answers:
author: Cyrille Martin
body: hi [@Tran Ngoc Duc](/t5/user/viewprofilepage/user-id/4911064)

You can follow the scenarios presented in this page : <https://confluence.atlassian.com/automationkb/automation-for-jira-how-to-update-the-request-participants-or-a-multi-user-picker-field-from-the-content-of-other-fields-1216971334.html>

Matching totally your need.

Regards

comments: author: Tran Ngoc Duc
body: Hi [@Cyrille Martin](/t5/user/viewprofilepage/user-id/604842) , thank you for looking into my issue. I already followed that article and tried the scenario 6, as I mentioned in my post, but it does not work.

In Scenario 6, I don't understand the JSON in Additional fields, so I copy the content to my automation. I created a test ticket and these are what I have done to test:

- Created a test ticket

- From portal, reporter mentioned user A ==\> User A was auto added to the Participant

- From Jira project (not portal), user A mentioned user B in the comment

==\> Expected result: User B was auto added to the Participant

==\> Actual result: User B was not added to the Participant. Admin had to add user B manually


author: Cyrille Martin
body: The JSON is splitting the comment by the character separating the user mentions. In the exemple - ; and ,

If in your case you just have one user mentioned, you can remove the split function and then you will have the user mentioned


author: Tran Ngoc Duc
body: Oh, thank you, this is my updated JSON

{  
"update": {  
"Participants": \[  
{{#issue.comment.last.body.substringAfterLast("\[\~").substringBeforeLast("\]")}}{"add": {"name":"{{.}}"}}{{\^last}},{{/}}{{/}}  
\]  
}  
}

If the comment is: "I do not have permission to grant access. Hi [@Cyrille Martin](/t5/user/viewprofilepage/user-id/604842) , could you help?"

Then will the JSON work? I am not sure if the user's name mentioned is in this format **\[\~julien1\]**


author: Cyrille Martin
body: Your JSON should work.

The format with the square bracket is used for DC for sure.


Tags: cloud

jira-service-management

jira-service-management-cloud

participant