Forums

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

JMWE Comment Issue Post Function

David Murphy September 2, 2020

I want to notify the reporter of an issue that they forgot to complete or fill in a field, e.g. Build ID, Environment, etc.

I am open to other post functions, however, my question here is can I create a comment that sends an email to the reporter using the following format in the comment?

@username comment

how do I construct that "@username" in nunjucks?

I have tried using the Display message Post Function but that only works in View issue mode so the reporter won't always see it

I have tried Email User post function but that won't send to the user doing the transition

3 answers

2 accepted

1 vote
Answer accepted
David Fischer
Community Champion
September 2, 2020

Adding an @mention in the comment is actually possible using the following code:

[~accountid:{{issue.fields.reporter._accountId}}]

 which is the "wiki markup" syntax for @mentions.

However, note that mentions are currently broken on the "old" issue view - they won't display properly.

David Murphy September 3, 2020

it doesn't seem to be generating the email that an @mention normally does or any notification

David Fischer
Community Champion
September 3, 2020

I'm sorry, I didn't think about that, but of course @mentions follow the same rule as any other Jira notification: Jira won't send notification emails to the author of the change, unless the recipient has opted to receive such "self-notifications" in their Preferences.

The workaround is to use the "run as" option of the post-function to create the comment as the "add-on user" (or another fixed user), so that it is never the same as the current user.

Like • John Funk likes this
David Fischer
Community Champion
September 3, 2020

And by the way, to answer the last line of your initial question, the same "trick" applies to the Email Issue post-function - if you use the "run as add-on user" option, the email will go out to the Reporter even when they're the current user.

Like • 2 people like this
subham patra
Contributor
May 28, 2021

I have a similar requirement to mention user in comments from a single user picker custom field. I am using JMWE "Comment issue post-function". Should this work for custom field as well? We are on DC! 

However getting below error using the same code (for reporter) :

Message:
Compilation error(s):
script_ffca1a040c2bdd640f280424f6ac324b.groovy: 1: illegal colon after argument expression;
   solution: a complex label expression before a colon must be parenthesized @ line 1, column 12.
   [~accountid:{{issue.fields.reporter._accountId}}]
David Fischer
Community Champion
May 28, 2021

@subham patra can you share a screenshot of the post-function configuration?

subham patra
Contributor
May 28, 2021

HI @David Fischer  - PFB,

Case 1:

JMWE_Comment.JPG

Case 2: Here "Employee Name" is a user picker field. In the comment the username is printing as a plain text, hence jira notification is not being sent to the mentioned user. 

JMWE_Comment3.JPG

David Fischer
Community Champion
May 28, 2021

@subham patra that's because, i the first post function, you selected Groovy Expression as the comment type. Change it to Text or Groovy Template. 

subham patra
Contributor
May 28, 2021

I have tried that as well. Now it's printing as a text.

JMWE_Comment4.JPG

David Fischer
Community Champion
May 28, 2021

That's the Cloud syntax. The Server syntax is the one you used in the other post-function. For a user mention, it'll be:

   [~${issue.get("reporter").name}]

or 

 [~<%=issue.get("reporter").name%>]

which are synonymous.

Like • subham patra likes this
Ron Chan July 28, 2021

Hi @David Fischer - your suggested syntax applies to the "reporter"

[~accountid:{{issue.fields.reporter._accountId}}]

What's the syntax for @mentioning users not on the issue?

David Fischer
Community Champion
July 28, 2021

Hi @Ron Chan ,

what do you mean by "users not on the issue"? Explicit (fixed) users? In that case, you'd need to get their accountId (with JMWE, you can use the "Lookup user..." button on the Nunjucks editor toolbar) and insert it:

[~accountid:124342435:2342334234:23423423]
Like • 2 people like this
0 votes
Answer accepted
John Funk
Community Champion
September 2, 2020
1 vote
David Reaves
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!
February 16, 2022

@David Fischer  Can you post the expression for Cloud?

David Fischer
Community Champion
February 16, 2022

@David Reaves The whole post is about Cloud, what makes you think otherwise?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, team '25 europe, atlassian event, barcelona 2025, jira, confluence, atlassian intelligence, rovo, ai-powered collaboration, developer tools, agile teams, digital transformation, teamwork solutions, atlassian conference, product announcements

🌆 Team '25 Europe registration is now open!

Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.

Register now
AUG Leaders

Atlassian Community Events