upon issue creation, check if issue with customfield value already exists

Koen Bruggeman
Contributor
May 4, 2021

Hello,

I want to link the most recent created issue, to existing issues which has the exact same value in the custom field 'serialnumber'. Which will result in linking issues with the same serialnumber.

I found below information, but I dont have a clue where to even begin. https://community.atlassian.com/t5/Jira-questions/Case-insensitive-check-script-validator-Unique-check-before/qaq-p/955531

Can my request be done with Automation?

What do I need?

2 answers

1 accepted

0 votes
Answer accepted
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 5, 2021

Hello @Koen Bruggeman ,

Thanks for reaching out and this can definitely be done with Automation Rules.

First off there are a few different concepts that I used in the example automation that can be found in the following documentation for a reference point and more detail on each action:

First I created a custom field named "Serial Number" of type "text", Noting that a text field will allow for alpha Numeric entry such as "ABC123".  Then I added it to the appropriate field configurations for the project, then I created an Issue link called "Duplicate Serial Number" as shown below:

Screen Shot 2021-05-05 at 5.30.27 PM.png         ...          Screen Shot 2021-05-05 at 5.31.34 PM.png

the Automation Rule I came up with will create variable smart values that can be used in a JQL search on a branch Rule operation, and link to matching issues found in the result set.  I set the rule up as follows:

  • When: Issue Created
  • Re-fetch issue data
    • NOTE: the re-fetch is a critical step for the follow-up JQL actions that pull any information from the current issue, as the issue data will not exist in the index until after the rule is done on a create issue trigger unless the re-fetch is added at an earlier point
  • Branch Rule - For JQL
    • Type of related issues
      • JQL
    • JQL
      • "Serial Number[Short text]" ~ "\"{{issue.Serial Number}}\"" AND KEY != {{issue.key}}
      • NOTE:  the syntax for the portion TextField ~ "\"value\"" means that the field will be exact without the end tags the value can be approximate.
    • Deselect the checkbox for the option:
      • "Only include issues that have changed since the last time this rule executed"
  • THEN: Link Issue to:
    • This Issue:
      • Existing Serial Number (Or any other desired issue link type for this operation)
    • Issue:
      • Trigger Issue

 

Screen Shot 2021-05-05 at 5.45.01 PM.png

Hope this helps and let me know if you have any additional questions.

Regards,
Earl

Koen Bruggeman
Contributor
May 6, 2021

Hello Earl,

 

Thanks a million! Implemented and running as we speak!

Like Earl McCutcheon likes this
Koen Bruggeman
Contributor
May 6, 2021

I also want to thank you for the great explanation of what happens and what each step does.

Very nice.

Like Earl McCutcheon likes this
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 14, 2021

Happy To Help smile

0 votes
Koen Bruggeman
Contributor
August 31, 2021

Hello again,

 

It still works, but i tried adding a comment and or sending a notficiation mail to the assignee of the most recent created issue, but it keeps doing that in for the linked issue. Meaning the oldest one, not the newest created issue.

I am probably stupid but I cannot make it sending a not mail or insert a comment to the most recent created issue.

Anyone can help?

Suggest an answer

Log in or Sign up to answer