Automation updating summary with variable applied more than once (Jira SD to Jira SD communication)

steven.green
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!
May 16, 2023

Yes, there are plugins for this, but really it shouldn't be required and this solution *does* work, just dirty.

Due to questionable design choices Jira SD does not play nicely with a 2nd SD, as such I've written an automation that picks up external ticket number in their response and adds it my ticket. This works great except for somehow despite the automation only running once it adds the external variable 3-5 times.

Process:

My SD creates ticket "[ABC-123] Summary Text",
client receives and sends standard response "Thanks for your ticket, we raised it as [XYZ-456]

At this point the automation kicks in, checks there is no instance of XYZ in current summary, and then creates two variables:
{{XYZTicket}} = {{issue.comment.last.body.match("(XYZ\W\d\d\d)")}}

and 
{{OldSummary}} = {{issue.summary}}

Then updates Summary with {{OldSummary}} {{XYZTicket}} 

This is proven to successfully update my original ticket from "[ABC-123] Summary Text" to "[ABC-123] Summary Text XYZ-456", this is perfect, the two desks can there-ever after add comments to each others tickets.

Except for some reason it doesn't do that, instead it becomes "[ABC-123] Summary Text XYZ-456, XYZ-456, XYZ-456, XYZ-456" Automation audit log shows only a single processing with ticket successfully updated.

I've also tested by adding a 3rd variable that combines the Old+XYZ and then dropping that into the Summary however it has the same outcome, multiple XYZ. We've also test the same code on the client side and they have the same outcome (also on Jira cloud)

1 answer

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 16, 2023

My first thought was: isn't this possible that the root cause is that the regex matcher somehow finds more than matches?

(For example, it produces 4 matches because the pattern contains 4 placeholder characters...)

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.
May 16, 2023

Hi @steven.green 

Yes, and...to what @Aron Gombas _Midori_ suggests, please post images of:

  • the entire automation rule,
  • the audit log details showing the rule execution, and
  • an example comment which was used in the rule.

Those may provide more context to explain this symptom.  Thanks!

Kind regards,
Bill

steven.green
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!
May 16, 2023

Ah fair, hadn't thought of that

I've rechecked their responses and its only mentioned twice, once in the email subject (which is dropped in the ticket) and once in the first line of the response.

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 17, 2023

Tip for troubleshooting:

There is an automation action that can write a log entry to the rule's audit log and which supports smart values. Add the action to your rule after matching the regex, but before updating a summary, and write the smart value {{XYZTicket}} to the log.

Then execute the rule and check the log:

  1. If the log entry contains the value printed as "XYZ-456, XYZ-456, XYZ-456, XYZ-456" -> the problem is with the regex matching and you should try to fix that!
  2. If the log entry contains the value printed as "XYZ-456" -> the regex matching is fine, but then the summary update is broken, you should fix that!

Suggest an answer

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

Atlassian Community Events