Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automation: check if user mentioned in comment belongs to project role

Pierre-Xavier Puissant
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 6, 2023

Hi there!

I'm pretty new to Jira, and I'm implementing some automations in my Service Desk project.

Among them, there is one automation that should execute when any user mentions another user that specifically belong to a defined project role (in an internal comment).

What I'm looking for here is: in automation, what would be the way to 1. check if a comment is internal and 2. if the user mentioned in this comment belongs to a specific project role?

Didn't find anything that could help me around here, looking forward for answers!

1 answer

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 6, 2023

Hello @Pierre-Xavier Puissant 

Welcome to the Atlassian community.

If you use the Issue Commented trigger then you can use an Advanced Compare to check if the comment was an Internal comment thus:

Screenshot 2023-11-06 at 1.24.30 PM.png

 

There is a method to extract from a comment all the users mentioned in that comment, described as part of this article:

https://confluence.atlassian.com/jirakb/automation-identify-users-mentioned-in-comment-and-add-them-to-custom-field-1283687360.html

However there is not currently a simple action/condition in Automation for Jira to check if a user is a member of a project role. There might be a way to check that through a REST API call made through a Send Web Request action, but I have not tried to figure that out.

Pierre-Xavier Puissant
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 7, 2023

Thank you very much @Trudy Claspill for your answer. It's a shame that Jira doesn't support this out of the box...

However, I see another option. It happens that the number of users belonging to the Project Role is pretty low (~8). So the other way would be to check whether any of those users is mentioned in the comment...

How is it possible to check if user x, y or z (let's say) is mentioned in the comment? Is it a basic string check?

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 9, 2023

What is actually stored in the comment when a user is mentioned is their account ID, not their name. The UI automatically converts that to display the name when you are viewing the issue, but in an Automation Rule if you used the Log action to print the comment body to the execution log you would see something like this for each mention:

[~accountid:62eaee831234509f4fdebf71]

To check if a specific user is mentioned you will have to get their account ID. You can do that using the View all issues screen to enter a search against a user field for the user:

You can type in the user's name to get a list of possible matches. Then when you pick the specific user the JQL will automatically update to show the user's account ID.

Screenshot 2023-11-09 at 11.33.03 AM.pngScreenshot 2023-11-09 at 11.33.33 AM.png

 

You can then plug that in to an Advanced Compare for a text comparison like this

Screenshot 2023-11-09 at 11.25.59 AM.png

 

If you want to check if any one or more of multiple users are mentioned in the comment then you would need to use the IF/ELSE block condition and add a condition for each user.

Make sure that you set the IF block to At least one condition matches.

 

Screenshot 2023-11-09 at 11.30.23 AM.png

Matthias Rieder
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 27, 2024

Hallo @Pierre-Xavier Puissant 

If you're still searching for a way to verify whether a mentioned user is a member of a specific group, I've recently come across an IF condition known as "User condition" that precisely addresses your need.

2024-06-27_09h05_10.png

 Regards

Edit:
Please ignore the above comment: this condition is only checking if the Users which are already set in my custom field "Mentioned User" are part of a specific group. It does not validate the users mentioned in a comment.

Suggest an answer

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

Atlassian Community Events