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 JQLreporter = example@example.com AND summary ~ "ABC*"
And: Issue corresponds to JQLsummary ~ "ABC*"
Then: Add comment to issue {{issue.description}}
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
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
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:
reporter = {{issue.reporter}} AND summary ~ {{issue.summary.match(".*\b(ABC.+)\b.*"}}
{{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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.