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

Using automation to send an email with the last 3 external comments

Robert (Bobby) Mittendorf February 22, 2023

I've been looking for a way to build an automation that sends an email to request participants that contains the last 3 external comments. I was able to make a nicely formatted portion but it only seems to be able to run on ALL comments instead of external explicitly:

{{#issue.comments.getFromEnd(0)}}
Comment by {{author.displayName}} on {{created.format("MM/dd")}} at {{created.shortTime}}:

{{body}}
{{/}}

So now the closest I've seen for this would be to use advanced branching to loop through all comments and perform an action only when {{issue.comments.internal}} equals false. In a perfect world this could iteratively add to a "Send email" action step, but that doesn't appear to be possible. So the next logical step is to see if this can be used to iteratively create variables instead, something like {{externalcomment(*)}} where (*) is the iteration of said variable. Does anyone know if this (or something equivalent) is possible?

3 answers

1 vote
Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 28, 2023

Hi @Robert (Bobby) Mittendorf,

I don't think that this is possible at the moment. The approach described by @Mark Segall isn't going to work as our branching happens async, so your main line can finish before the branches have and variables created on a branch are only scoped to that branch.

If it was just the last three comments it might be possible but without list filtering I can't think of a way to get the last three external comments.  

Robert (Bobby) Mittendorf March 1, 2023

Yeah I wasn't sure if that suggestion would work but I chalked it up to my explanation over anything else.

I DID figure out a way to do this though! I don't think it's a good solution, mind you, but it would work.

I would have an automation create a temporary issue, then use a For Each loop to conditionally add external comments to that issue. After that completes it would trigger another automation to extract the relevant comments (depending on order), put those in an email, and delete the dummy issue. I don't accept this as a viable solution because I would either have to create a large number of issues on this client's main project or set these automations to global to avoid messing with their increments.

This does make me think that an automation action that could do this without cluttering up metrics or increments would be very useful though.

0 votes
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.
March 12, 2023

Hi @Robert (Bobby) Mittendorf 

Are you using Cloud or Data/Center version?

If you are using Cloud, I wonder if you could...

  • using smart value list filtering, extract the external comments into a created variable
  • split the created variable, and then grab only the last three (referencing with get(), adding conditional logic to handle when there are less then three comments.

I have not tried this exact scenario, so perhaps experiment with it.

Kind regards,
Bill

0 votes
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 22, 2023

Hi @Robert (Bobby) Mittendorf 

I believe you're on to something with the variable approach.  I can't find my example of this, but I'm pretty positive it worked...  You'd basically set the equivalent of a declare where you give it some random value as a starter and then create the same variable inside the branch:

  • Create Variable
    • varComment1
    • 0
  • Create Variable
    • varComment2
    • 0
  • BRANCH 1
    • Create Variable
      • varComment1
      • {{yourcomment}}
  • BRANCH 2
    • Create Variable
      • varComment2
      • {{yourcomment}}
  • Send Email
    • {{varComment1}}
      {{varComment2}}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events