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

Smart Value text fields {{issue.comment}}

Roland Uittenbogaard February 2, 2023

Hello,

I have an Automation that works but I want to change it slightly. I looked for information everywhere for smart value {issue.comment} and variations to it, but it fails. 

 

The Automation sends an e-mail to 1 person from organization ABC, if comment is added to one of the issues (tickets) from someone from ABC, so

When: Issue commented; comment is the main action.

If: Organization is ABC

Then: Send e-mail (to 1 person of ABC)

 

The following script (an example in Jira Help) in the e-mail works:

Subject:

Issue {{issue.key}} was just updated!

Content:

{{#issue.comments}}
Comment by: {{author.displayName}} at: {{created}}
{{body}}
{{/}}

If there is an issue from ABC where comment is added it sends an e-mail with all comments on that issue, see below the Content of the e-mail it generates:

Comment by: Roland Uittenbogaard at: 2023-01-16T09:19:52.2+0000

[Tekst of the comment]

Comment by: [name of someone from ABC] at: 2023-01-17T08:01:03.9+0000

[Text of the comment]

Comment by: Roland Uittenbogaard at: 2023-01-18T12:52:45.7+0000

[Text of the comments]

 

Now I only want to send the last comment of that issue, not all comments on that issue. I tried the following:

{{issue.comments.last.body}}
Comment by: {{author.displayName}} at: {{created}}
{{body}}
{{/}}

{{issue.comments.last}}
Comment by: {{author.displayName}} at: {{created}}
{{body}}
{{/}}

Both fail. I can find smart values and some examples in Jira Help, but not a coherent manual or explanation of possible smart values. Thanks for any help.

2 answers

1 accepted

2 votes
Answer accepted
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 2, 2023

Hi @Roland Uittenbogaard - If this rule is triggering on new comment, you should have everything you need and not have to parse for last comment, because the trigger action IS the last comment.  Try this for your email:

Subject:

Issue {{issue.key}} was just updated!

Content:

Comment by: {{comment.author.displayName}} at: {{comment.created}}
{{comment.body}}
Roland Uittenbogaard February 6, 2023

Hi @Mark Segall ok I understand what you mean by the trigger action IS the last comment. But because the first example I found was giving all the comments of the issue, I thought you had to specify in the e-mail which comments you want to send.

Your answer seems to work correct. Thank you for answering, I appreciate it!

I thought your answer would be correct if comment would be changed to comments because I found the smart value {{issue.comments}} and not {{issue.comment}}. My subject in the header is also {{issue.comment}} but I meant to write {{issue.comments}}. 

Also will it work with {{author.displayName}} instead of {{comment.author.displayName}}? And I thought you would need {{issue.comments.body}} instead of {{comment.body}}. Just trying to understand the logic. So I will make the same automation but only sending myself an e-mail so I can try some other combinations. I will let you know if some other combinations also work.

Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 6, 2023

When your rule has been triggered by a comment, you can just use comment singularly because it is referring to the comment that triggered the rule.  When you're trying to perform actions against the entire comment listing for an issue, it is plural (e.g. {{issue.comments}})

I hope this makes sense.

Like Roland Uittenbogaard likes this
Roland Uittenbogaard February 6, 2023

Hi @Mark Segall oh I looked at smart values and I found {{issue.comments}} and not {{issue.comment}} so I thought you had to use {{issue.comments}} for both 1 comment or more comments. So your answer clarifies. Thank you.

Like Mark Segall likes this
Roland Uittenbogaard February 10, 2023

Hi @Mark Segall I promised you to show other combinations that I tried, but they don't work.

Comment by: {{comments.author.displayName}} at:{comments.created}}
{{comments.body}}
You get all authors, all dates, and all comments

Comment by: {{author.displayName}} at: {{created}}
{{comment.body}}
You get an empty field for Comment by, date is of issue created, not
the date of the new comment

Comment by: {{comment.author.displayName}} at: {{comment.created}}
{{issue.comment.body}}
You get 1 author, 1 date, but all the comments

Comment by: {{comment.author.displayName}} at: {{comment.created}}
{{issue.comments.body}}
You get 1 author, 1 date, but all comments.

So for the last 2 cases both {{issue.comment.body}} and
{{issue.comments.body}} give all the comments.

So only your answer gives the solution that I was looking for. Not bad! Thanks again.

Like Mark Segall likes this
0 votes
Ali Sasanipour November 23, 2023

Hi there,

 

i have a question, how can i export the comment without "internal comment"?

i used the follow commands:

{{#issue.comments}}
Comment by: {{author.displayName}} at: {{created}}
{{body}}
{{/}}

 

i hope you can help me.

 

Best Regards,

 

Ali

Suggest an answer

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

Atlassian Community Events