How to: Add all @-mentioned users/customers (in the comment) to the Request Participants.

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

Often time business process flows require that the users/customers mentioned in the comments are to be added to the request participants list. This is not possible out of the box. This article presents a solution using automation.

Environment

Jira Service Management cloud

Please generate Basic Auth Credentials for REST API

Under the heading "Supply Basic Auth Headers" of this document, please follow the steps 1-3 and copy the final string in the "Authorization" header value for all 3 "Send Web Request" action.

Solution

(Auto-migrated image: description temporarily unavailable)

Two conditions are checked before adding request participants.

The comment is not an internal comment, and the body of the comment contains at least one user mentioned.

(Auto-migrated image: description temporarily unavailable)

(Auto-migrated image: description temporarily unavailable)

Finally, using the ''Send web request* action, add all mentioned users to the request participants list.

(Auto-migrated image: description temporarily unavailable)
1 2 3 4 5 REST Endpoint: {{baseURL}}//rest/servicedeskapi/request/{{issue.key}}/participant Payload: {"accountIds":[{{#issue.comments.last.body.replaceAll("\\n", "").split(" ").substringBetween("[~accountid:", "]")}}"{{.}}"{{^last}},{{/}}{{/}}]}

Explanation of functions in the payload

replaceAll("\\n", "") : Removes/replaces-with-empty all new-line characters from the comment body before extracting user account IDs.

split(" ").substringBetween("[~accountid:", "]") : splits the words/tokens that the expression substringBetween("[~accountid:", "]") produces which are basically the account IDs and converts the list of accountIDs int o an array for processing/iteration.

This whole payload code will generate the json that will be used by the web request to add all users as request participants.

Automation Rule .json (imported) file. Please refer to this article to learn more about Import and export Jira automation rules.

Automation rule .JSON

1 {"cloud":true,"rules":[{"id":20992998,"clientKey":"fd13fe83-0060-3148-9e44-0578305ad3c1","name":"Add @-mentioned users as Request Participants.","state":"DISABLED","description":"","authorAccountId":"557058:febb5479-9025-48a7-ac00-1e6f2c53d979","actor":{"type":"ACCOUNT_ID","value":"557058:f58131cb-b67d-43c7-b30d-6b58d40bd077"},"created":1723072993431,"updated":1724627972933,"trigger":{"id":"578085015","component":"TRIGGER","parentId":null,"conditionParentId":null,"schemaVersion":1,"type":"jira.issue.event.trigger:commented","value":{"eventKey":"jira:issue_updated","issueEvent":"issue_commented","eventTypes":[]},"children":[],"conditions":[],"connectionId":null},"components":[{"id":"578085016","component":"CONDITION","parentId":null,"conditionParentId":null,"schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{comment.internal}}","second":"false","operator":"EQUALS"},"children":[],"conditions":[],"connectionId":null},{"id":"578085017","component":"CONDITION","parentId":null,"conditionParentId":null,"schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{issue.comments.last.body}}","second":"[~accountid","operator":"CONTAINS"},"children":[],"conditions":[],"connectionId":null},{"id":"578085018","component":"ACTION","parentId":null,"conditionParentId":null,"schemaVersion":1,"type":"jira.issue.outgoing.webhook","value":{"url":"{{baseURL}}.atlassian.net//rest/servicedeskapi/request/{{issue.key}}/participant","headers":[{"id":"_header_1724194892800","name":"Content-Type","value":"Application/JSON","headerSecure":false},{"id":"_header_1724195652849","name":"Authorization","value":"","headerSecure":false}],"sendIssue":false,"contentType":"custom","customBody":"{\"accountIds\":[{{#issue.comments.last.body.replaceAll(\"\\\\n\", \"\").split(\" \").substringBetween(\"[~accountid:\", \"]\")}}\"{{.}}\"{{^last}},{{/s}}{{/}}]}","method":"POST","responseEnabled":false,"continueOnErrorEnabled":false},"children":[],"conditions":[],"connectionId":null}],"canOtherRuleTrigger":false,"notifyOnError":"FIRSTERROR","projects":[],"labels":[],"tags":[{"id":86109111,"ruleIdUuid":"01912f27-5897-7fd5-9046-71c04db0edb0","tagType":"IS_RULE_UPDATED","tagValue":"true"}],"ruleScope":{"resources":["ari:cloud:jira:59b8197a-2cf9-4518-a22e-2693f08776fa:project/10006"]},"ruleHome":{"ruleLifecycleHome":{"locationARI":"ari:cloud:jira:59b8197a-2cf9-4518-a22e-2693f08776fa:project/10006"},"ruleBillingHome":{"locationARI":"ari:cloud:jira-servicedesk::site/59b8197a-2cf9-4518-a22e-2693f08776fa"}},"writeAccessType":"UNRESTRICTED","collaborators":[],"billingType":"NORMAL","idUuid":"01912f27-5897-7fd5-9046-71c04db0edb0"}]}

Reference documentation links:

Updated on April 11, 2025

Still need help?

The Atlassian Community is here for you.