I am working on Automation to send the last n comments through email. For example, an issue contains 4 comments. Comments 1-4. I know that in order to get the latest comment I use {{issue.comments.last.body}}. Is it possible to show comments 2-4?
Hi @Vanessa Marie Delfin -- Welcome to the Atlassian Community!
Have you tried this function: getFromEnd()
You could first check if {{issue.comment.size}} is < 5 and then show the whole list, or use the function and count backwards for your values: 3, 2, 1, 0
Kind regards,
Bill
Hello @Bill Sheboy Thank you for the welcome!
I'm sorry I explained my situation wrong. If I have an issue that contains 10 comments and I want to print out the last 3 comments including the author's name
I thought about using the getFromEnd function like you suggested but it will not work in my situation since the index is static. For an issue with 10 comments, I will put
getFromEnd(10)
getFromEnd(9)
getFromEnd(8)
but if the issue gets a new comment, now a total 11 comments, it will always get the comments 10 9 8.
I need something more dynamic and after looking at the link you gave me it might not be possible. Would you happen to know of a different approach?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The index used in getFromEnd() is relative from the end of the list. I just tried this again with my test rule, and when I use:
Here is my test rule, which successfully wrote the correct comments to the audit log.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy, happy to find you in here.
Would you know which is the syntax to get the second-last comment of a child issue?
I have tried the followings out but they haven't worked:
{{issue.subtasks.comments.getFromEnd(1).body}}
{{issue.subtasks.comments getFromEnd(1).body}}
Thanks in advance,
Vincenzo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My apologies for the delay in responding as I have been offline for a while.
Next thing, as this is an older thread, I recommend creating a new question, perhaps linking back to this one. That will ensure the maximum number of people see it to offer suggestions.
When you create your new question, please include:
Those will provide context for the community to help.
From what I can see thus far in your rule syntax...
This results in getFromEnd() probably operating on the second-to-last subtask, and not comments.
Back up to point #1, what problem are you trying to solve, as that will indicate how to proceed?
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Bill Sheboy
Sorry for the delay as well but I was off a couple of days.
In the meantime I have resolved it.
Thanks also for your suggestions.
Kind Regards, Vincenzo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.