We have Jira Service Desk Cloud. We also have an external service that reports on issues every 15 minutes until the particular issue is solved. For example, we are an ordering platform for restaurants and sometimes a product order will fail to be sent onto their foodservice vendor. We have an alert from the external service that says order number xxxx failed. If the order hasn't gone through by the next time the service checks for it, we get another alert.
The alerts come via a particular email address. The body and subject of the email is the same every time it fires.
I see one ticket per instance of an order number that is failing, so if order number xxxx is failing, I would see one ticket for the first time the service checked, then another ticket for the next time the service checked and so on.
I would like to avoid these duplicates. Since the body and subject of the emails are identical to one another, is this possible through an automation of some sort? I have ScriptRunner and Automation for Jira, but haven't been able to solve this yet.
It doesn't look like advanced mail loop detection is the right fit here since the emails are 15 minutes apart.
Thank you!
- Drew Nedderman
You can try using the Lookup Issues action under Automation https://support.atlassian.com/jira-software-cloud/docs/automation-actions/#Automationactions-Lookupissues. You can run a JQL to identify if there are already existing records with the same Summary field as the new issue. If so, cancel (or deleted if you'd like) the new issue automatically.
See the example below.
Thanks for this, it was very helpful. I can confirm it works, but needs a few changes, mainly removing the special characters from the searched summary and escaping quotes (
+ - & | ! ( ) { } [ ] ^ ~ * ? \ :
as documented here: https://confluence.atlassian.com/jiracoreserver073/search-syntax-for-text-fields-861257223.html#Searchsyntaxfortextfields-escapingSpecialcharacters).
summary ~ "{{issue.summary.replace("\"","\\\\\\\"").remove("*").remove("{").remove("}").remove("[").remove("]").remove("+").remove("-").remove("&").remove("|").remove("!").remove("(").remove(")").remove("^").remove("~").remove("?").remove("\\\\").remove(":")}}"
Another change I made to simply delete the newly created ticket instead of transitioning to Canceled.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
How can I do the same for a custom field, We need to avoid duplicated issue with same data.
Thanks for help, We have Jira Server
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Speaking about server here... but I think the same is true for cloud.
The default mail handlers have mail threading handling capability.
But that is based on the "message-id" header. If you can somehow cause the external service to generate and re-use a single message-id header for a given alert, then each new email will be appended as a comment on the initial issue created.
Scriptrunner doesn't come between your mail handler and the ticket creation.
The only thing that scriptrunner can do for you is react to the ticket creation, check if a similar ticket exist, then delete or discard the newest one. But any notification associated with the ticket creation or deletion will still take place.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'll reply back here once I've had a chance to test this. Looks like it could work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter-Dave, we tried sending emails that had duplicate message-id headers, but no luck. Each email created a ticket. Any other thoughts on this? Thank you!
- Drew Nedderman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No other ideas. Like I said I haven't worked with Cloud much and I'm not clear on the email handler situation there.
All I'd say is to look carefully at the documentation page:
Maybe something could be done using the "in-reply-to" header.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"The only thing that scriptrunner can do for you is react to the ticket creation, check if a similar ticket exist, then delete or discard the newest one. But any notification associated with the ticket creation or deletion will still take place."
thats exactly what i am trying to do too - delete or discard. but how do I check if it already exists in the first place? i don't want to create issue with same summary. Please help.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Interestingly, I have the same question exactly after an year on Jan 12th, 2022. Lol :) I will try the above scenarios and post the answer for new folks observing this need.
Thanks,
Srikanth Ganipisetty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.
Learn more
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.