Removing Duplicate Tickets Created from Automation
Asked by Jason Wasula:

Hello All,

I have a main project board (HMA) with over 300 tickets encompassing many topics and is our communication source with another company. Everything has a due date, so what I have done was create a separate project / board (JAW) to track issues coming due within 2 business days. I have an automation in the HMA project pulling those issues that meet the criteria into the new project / board (JAW).

To piggyback off that, in the new board (JAW) I have automations to move tickets from due \< 2 days, to due \< 1 day, and to past due if not they are not resolved. An automation to move to Done in the new project board is forthcoming however I am getting stuck with duplicate entries as the automation from our main board (HMA) runs daily. I have not figured out a way to stop ticket from going over if they've already went. Explored options there, but nothing worked (spent too many hours on this and moved on to other options)

Now, I am focusing on the new board (JAW) and put together a new automation there to Delete Duplicate new entries added. I am pretty sure everything is set up appropriately:

<br />

Automation:  
When: Issue Created

Then: Lookup issues  
JQL Search: summary \~ "\\"{{issue.summary}}\\""

If: Compare two values  
Check if:  
{{lookupissues.size}} is greater than 0

Then:  
Permanently remove this issues

When I add known duplicates from HMA to JAW, I can see in the audit log of my "Delete Duplicates" automation and it's running as expect. It also identifies the duplicate entry. However, the ticket does not get deleted.

Action Details say:

Advance compare condition:  
The following issues did not match the condition: JAW-xxx

Associated events:  
JAW-xxx (Newly added Ticket)

Lookup issues:  
JAW-xxx, JAW-aaa (tickets with the same summary)

So this shows me the automation is identifying tickets that are duplicates, but not deleting the new entry.

Any assistance on this is much appreciated.

Thank you!


Answers:
author: Bill Sheboy
body: Hi [@Jason Wasula](/t5/user/viewprofilepage/user-id/5368875) -- Welcome to the Atlassian Community!

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected. Those will provide context for the community to offer ideas, ensuring we are aligned on your current rule(s). Thanks!

Until we see those...

Next thing: a rule which is performing this type of issue deletion could cause havoc if it has problems. Please consider if instead the deletion should always be paired with creating / cloning issues to reduce the chance of errors.

Please confirm if you are using multiple different projects or just different boards in one project:

* If this is one project (multiple boards) a project-scope rule may be used
* If this is multiple different Jira projects, a multi-project or global scope rule would be needed

Finally, what is your Jira version (Cloud, Server, Data Center), and version (Free, Standard, Premium, Enterprise)? The rule you are describing may require many rule executions, and since the licensing / package model changed, it could encounter the new limits: <https://www.atlassian.com/blog/announcements/cloud-automation-packaging-update>

Kind regards,  
Bill

comments: author: Jason Wasula
body: Thanks [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313)   

I'll start with the questions first. These are different projects (under our enterprise license), not boards:  
HMA is Company Managed Software  
JAW is Team-Managed Software

Our JIRA is cloud based, and we are using an Enterprise version.

As far as the automations, I just have one automation going from HMA to JAW and it works just fine for what I am trying to grab:  
![2023-11-20_19-44-59.png](https://community.atlassian.com/t5/image/serverpage/image-id/292858i632E8B1DF9574BC3/image-size/large?v=v2&px=999 "2023-11-20_19-44-59.png")

I did play with many another conditions within to try to stop tickets going over that have already gone over, but exhausted my efforts there. If there is something you know that I couldn't figure out, let me know and that would eliminate the need for what I did next (below) in lieu of not figuring it out in the above automation. Simple terms, don't add a ticket to JAW if it's already went over.

Backup try to not having duplicates was to hop over to to the JAW board to simply eliminate duplicates. Here is the automation I created for this:  
![2023-11-20_19-53-50.png](https://community.atlassian.com/t5/image/serverpage/image-id/292855i200265C4754735A2/image-size/large?v=v2&px=999 "2023-11-20_19-53-50.png")

From the audit log, what I can see is the look up is working because the two tickets listed under Lookup issues are the duplicative of each other. I am not sure why it's saying the newly added ticket does not match the condition.   
![2023-11-20_19-58-23.png](https://community.atlassian.com/t5/image/serverpage/image-id/292856i09C7CC36BE337CFE/image-size/large?v=v2&px=999 "2023-11-20_19-58-23.png")

Appreciate the time anyone takes to review and appreciate your response, Bill. Open to any and all suggestions. I have been using JIRA less then a year, and have heavily relied on historical community posts to accomplish improvements with our projects. This one however is beating me.


author: Bill Sheboy
body: Thanks for that information, Jason!

Would you please explain...You describe copying these issues to the other project as their Due Date approaches. Why do that instead of just having a different board which filters on the date, keeping all issues in one project? For example, is this a security / visibility issue to limit who sees which issues?

Next, rather than delete issues (i.e., clean up after the create), **instead try adding the condition checks before the issues are created**. That will prevent the duplication from happening, and eliminate the need for the second rule.

In your rule, "Deletion of Duplicates" and the condition check, I note you are trying to match on summary. So the people using the JAW project ever update the Summary? If so, the matching will not work.

And for the advanced compare condition in that rule, smart values are name, spacing, and case-sensitive. The smart value for lookup issues is {{lookupIssues}} so perhaps change the condition to use:

```
{{lookupIssues.size|0}}
```

And you probably want to test if the value is greater than 1, as the trigger issue will be returned also.