Forums

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

"Prevent duplicates by only adding this comment once to a particular issue" not preventing duplicate

Dylan Alperin
Contributor
July 25, 2022

I have an automation like the below where I only want it to trigger once when first assigned.

  • When: Issue Assigned
    • Rule is run when issue is assigned to a user.
  • If: Matches
    • Issue type equals (Internal issue type)
      • Then: Add comment to the issue
      • "Please blah blah blah"
      • Prevent duplicates is turned "ON"

Why is it duplicating when I reassign?

Test.jpg

2 answers

2 accepted

0 votes
Answer accepted
John Funk
Community Champion
July 25, 2022

Hi Dylan - Welcome to the Atlassian Community!

Jira doesn't know when an issue is assigned if it is the first time or 20th time. So you need something else there to check it. 

Maybe try creating a new custom number field and set the default to 0. 

Then add another Condition to check if the value of the custom field is 0. If so, they it would fire.

But you also need add an Edit Issue action at the end to set the value of the custom field = 1. 

So the first time it is assigned, then the custom field is 0. The trigger passes the condition, adds the comment. And at the end of that, it updates the custom field to 1. 

The next time the issue is assigned, it checks the custom field, which is now 1. So it fails the condition check and does not fire. 

Dylan Alperin
Contributor
July 27, 2022

I'll try the workaround but curious why there is a feature to prevent duplicates when it doesn't seem to be able to prevent them

Like # people like this
John Funk
Community Champion
July 27, 2022

That's probably a question for Atlassian Support. 

0 votes
Answer accepted
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.
July 25, 2022

Hi @Dylan Alperin -- Welcome to the Atlassian Community!

The option to prevent duplicates detects if the comment text (body) is exactly the same.  Does that match your use case?

If not, you will need another way to detect duplicates, such as:

  • check if the previous value of the assignee was empty with an Advanced Compare Condition:
    • first value: {{#changelog.assignee}}{{fromString}}{{/}}
    • condition: equals
    • second value: empty
  • or...check if any prior comments (or fields) have some pattern you can detect

Kind regards,
Bill

Dylan Alperin
Contributor
July 27, 2022

Yes it is exactly the same, its just the one automation to add the comment so strange it doesn't detect it.

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.
July 27, 2022

Awesome; you have definitely found a bug.  I recommend working with your site admin to submit the defect here: https://support.atlassian.com/contact/#/  I was able to reproduce this symptom as follows:

Steps to reproduce:

  1. create a manually triggered rule, with a single action to add a comment with some text, such as "Here is a simple comment which would should not duplicate!"
  2. confirm the add comment option is "Prevent duplicates..."
  3. publish the rule
  4. open an issue in the same project as the rule
  5. run the rule from the issue
  6. run the rule a second time
  7. disable the rule
  8. enable the rule
  9. run the rule a third time

Expected results:

Step 5 adds a comment and Steps 6 and 9 do not add duplicate comments

Actual results:

Step 5 adds a comment and Step 6 does not.  However toggling the rule off/on leads to Step 9 adding a duplicate comment.

Work-around:

Add other fields/values to detect that the comment was added earlier and check for the condition created to prevent duplicate comments.  Apparently making a change to the rule changes the thing preventing duplication.

Like Dylan Alperin likes this
John Funk
Community Champion
July 27, 2022

Dang - I'm worn out just reading that.  :-)  Thanks for all of the hard work, Bill!

Like Bill Sheboy likes this
Caleb TeBokkel
Contributor
May 8, 2023

Is there a bug ticket somewhere for this? I still have this issue

Like Patrick likes this
Stefano Vidonis September 9, 2024

Yes still there in Jira Datacenter 

  • v9.4.21

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events