Forums

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

How to find the last comment made by Automation initiator

Daniel Boling April 26, 2023

Hello,

We are wanting to create a variable in our Automation rule that returns the body of the last comment made in the Issue, by the initiator of the rule.

 

The following returns the last comment in the issue where the automation is executed.  However, the author of the last comment could be from any Jira user.  We are looking for the last comment from a specific Jira user.

{{issue.comments.last.body}}

 

Desired outcome in pseudocode

{{issue.comments[where author.displayName = initiator.displayName].last.body}}

 

Thanks for your input

1 answer

0 votes
Himanshi
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 26, 2023

Hello @Daniel Boling , 

Welcome to the community!

You can try with {{initiator.displayName}} has the change {{issue.comment.last.body}}

Initiator.displayName refer to the user who triggered the rule.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-users/

Hope this would help! Have a great day

Daniel Boling April 27, 2023

Thanks, Himanshi. 

We are attempting to create a string of comment id's in the issue based off the initiator's display name, delimited by ",":

{{#issue.comments}}{{#if(equals(author.displayName, initiator.displayName))}},{{id}}{{/}}{{/}}

 

However, initiator.displayName is returning a blank in the if statement.  Is there a restriction that would prevent us from using that particular smart variable in the if statement?

Suggest an answer

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

Atlassian Community Events