Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation to find duplicate issues with same custom field value

Use case: User want to have a unique value on all work items for a specific custom field. We need to check whether there are any other work item with same field value, if yes then add a comment on the newly created work item and move the issue to done/duplicate status.

 

We can use the following JQL query (lookup issues) and advanced compare condition achieve this requirement.

"Global field for Team project[Select List (multiple choices)]" = {{triggerissue.customfield_10470}} and issuekey != {{triggerIssue.key}}

 

Need to replace the actual custom field ID on above JQL.

 

Screenshot 2025-05-23 at 2.06.53 PM.pngScreenshot 2025-05-23 at 2.07.02 PM.pngScreenshot 2025-05-23 at 2.07.10 PM.pngScreenshot 2025-05-23 at 2.07.20 PM.pngScreenshot 2025-05-23 at 2.07.37 PM.png

1 comment

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 23, 2025

Hi @Mohanraj Thangamuthu 

Here are two suggestions to improve your rule, increasing the chances it will work as expected:

1) The Work Item Created trigger (among others) has racetrack timing problems.  That is, the rule can start running before all work item data is available to the rule.  For your rule, this means the custom field data may be empty when you try to match it with the Lookup Work Items action using JQL, leading to false-negative results.

The mitigation for this trigger defect is to always add the Re-fetch Work Item Data action immediately after this trigger type.  That will slow the rule slightly, reloading the data before the steps continue.

 

2) As you show, when the Lookup Work Items action gathers results, the list size function may be used to count the work items.  Unfortunately, that action has intermittently started returning null for the list when there are no results, rather than an empty list...and so size will not return 0...possibly leading to rule errors or invalid condition results.

The mitigation for this symptom is to add a default value of 0 when the size function returns null:

{{lookupIssues.size|0}}

 

Kind regards,
Bill

Like # people like this

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events