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!
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:
There is a method to extract from a comment all the users mentioned in that comment, described as part of this article:
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.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You can then plug that in to an Advanced Compare for a text comparison like this
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.