Deduplicate issues from reporters

Joachim Due
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!
November 9, 2024

Hello!

I’m stuck with JSM Automation (Cloud) and was wondering if any bright minds here could help me find the right way forward.

We have a service project where issue creation via email is enabled, and I want to reduce as many duplicates as possible. One place I want to start is by using a specific sender.

This sender has the email address example@eksempel.com, and in the subject line of the email, there is always a reference number, let’s call it ABC12345 for now.

What I want to do is have an automation that reads newly created issues, checks if this reference already exists in an existing issue, and then adds the body as a comment. If the reference doesn’t exist, I want Jira to continue with the issue creation.

The problem I’m running into is that when the reference doesn’t exist, Jira creates the issue as usual, but it seems like the rule goes back, checks the new issue, and adds the body to the comment field (duplicating the information in both the description and comment field).

Does anyone have any suggestions on what I can do?

Here’s the rule I currently have:

When: Issue is created
If: Issue corresponds to JQL
reporter = example@example.com AND summary ~ "ABC*"
And: Issue corresponds to JQL
summary ~ "ABC*"
Then: Add comment to issue {{issue.description}}

3 answers

4 votes
mararn1618 _secretbakery_io_
Atlassian Partner
November 11, 2024

Hi @Joachim Due, I have a blogpost that explains how to link and close duplicate issues using automations - hope that solves your issue?

Kind Regards,
Markus // Author of Duplicate AI

4 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 9, 2024

Hello @Joachim Due 

Welcome to the Atlassian community.

Automation Rules run when an event has been completed, so the new issue will always be created. You can't stop the issue from being created.

The way your rule is written all the steps are being applied to the newly created issue. I am guessing that you instead want to add information to another pre-existing issue that matches the new issue. Is that correct?

If so, how do you identify that other pre-existing issue? I understand that the will have the same reference number. However you may end up with several issues that have the same reference number over time. What other criteria do you want to use to identify the one issue you want to update? Would you want to find the one that is not in a "done" status?

And then what do you want to do with the newly created issue? Do you want to transition it to a "cancelled" status?

1 vote
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 9, 2024

Hey there - I actually think this can be done, thanks to something @John Funk recently posted [Forms Automation: Access form fields with smart values (smartvalues)

By "this" I mean you can't PREVENT new issues from being created (@Trudy Claspill is absolutely right), but you can DELETE new issues that are duplicates immediately after they're created.

And ALSO, I realize now, it could be done without forms. 

Now, I think her solution of auto-cancelling (and I might suggest linking as duplicate?) the newly created issue is probably the better way to go, but for fun...

THING THAT WORKS BUT IS PROBABLY A BAD IDEA

A more RADICAL idea (which is what I just tested with the new Forms functionality), is to check the Summary for "ABC.+", and if it FINDS it:

  • Do a lookup for: reporter = {{issue.reporter}} AND summary ~ {{issue.summary.match(".*\b(ABC.+)\b.*"}}
  • Add a comment to matching issue: {{issue.description}}
  • DELETE recently created issue

Like I said. Deleting is a radical, or really drastic step. You would want to test the crap out of this. It's also a pretty horrible user experience because both Forms and regular Issue Create will pop-up a message: "ISSUE-123 created" and if your Automation has deleted the issue, they will get a nasty error.

(IF ONLY Automation let you pop-up notifications of our own, or override Create pop-ups.)

So yeah, auto-cancelling and linking is probably better. 

But I did give it a try, and when triggered from a Form, I was able to match on the "summary" field in the last submitted form, and delete the associated issue that it created. Crazy the stuff Automation can do. But that doesn't mean you should do it.

RE: FORMS

For reference, I tested this using the "When: Forms submitted" trigger.

I used a smart values condition on: {{forms.last.summary}} checking if contained the regular expression "ABC.+"

(Make sure you set a field key in your form. It doesn't work if you only set a display name.)

One huge issue here is that the Trigger doesn't seem particularly configurable right now. I could not select the specific form (but I did have to constrain the rule to the project that contained the form, since forms are not available in Team projects).

If you use forms in other projects, you will most definitely want to check the {{issue.project.key}} to make sure this is the right project. 

Probably also want to Lock the form once submitted, so a subsequent edit doesn't delete a NON-duplicate issue.

And probably the biggest flaw in this approach is that once you create a form for your project, I don't see a a way to restrict it ONLY for issue creation, and NOT being available for existing projects. Drat.

 

 

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events