Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can automation detect the use of @ in a comment?

Howard Sims May 1, 2025

I need to create a Jira rule that is triggered when a specific person is mentioned in a comment using the @ feature.

Example: In a comment someone writes
"@John Smith This is now ready for testing."
I want to trigger a rule

But if someone writes
"@Jane Smith This is now ready for testing."
I don't want to trigger the rule

1 answer

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 1, 2025

Hi @Howard Sims -- Welcome to the Atlassian Community!

No, you cannot prevent the rule triggering.  But you can prevent it from continuing to process...

When someone is mentioned in a field, that appears like this internally:

[~accountId:557057:1d4fd7f4-bbac-4466-82ee-aaabbbccc]

Their user account ID value is used rather than their display name.

And thus a rule could use a Smart Values Condition immediately after the trigger to check if a specific user was mentioned.

Kind regards,
Bill

Howard Sims May 1, 2025

What do I use to get the contents of the comment? and how would I search in it for the nameID?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 1, 2025

First thing: based upon your response, I recommend pausing to read the introductory information on automation rules and smart values:

 

Learning more about automation before trying to write a rule will help you experiment and better understand how to write and manage rules effectively.

 

Back to your follow-up questions, getting the contents of the comment depends upon your rule trigger...

Let's assume your rule is triggered on Work Item Commented.  Then the comment from the trigger would be {{comment}} and the text in the comment would be {{comment.body}}  The Smart Values Condition could then test for the expression in that text.

  • trigger: work item commented
  • smart values condition:
    • first value: {{comment.body}}
    • condition: contains
    • second value: [~accountId:the user account ID value]
  • do something...

 

You will need to find the user's account ID for the condition, using their profile information, JQL, the REST API, etc.

 

Howard Sims May 6, 2025

Thanks Bill. Worked perfectly.

Like Bill Sheboy likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 6, 2025

Awesome; I am glad to learn it is working!  Please consider marking this question as "answered" to help others with a similar need find solutions faster.  Thanks!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events