Hello,
Before a ticket is closed, I would like to make sure that a value of a text field in the current ticket is unique value with the same fields in all other tickets.
Is there a way to do this using automation rules?
Hello @James Park
Are you looking at the entire contents of the text field as a whole, or just some part of the text field? Does a difference in the case of the text make it a unique value?
Can you provide more context on the problem you are trying to solve? Why are you using a text field to try to track a value and ensure that value is unique across all tickets? How does the value of that field get set?
How many issues are going to need to be reviewed? Tens of issues? Hundreds of issues? Thousands of issues? How frequently are new issues created? How often is the field updated?
You could create an Automation Rule that is triggered by a change of value on that text field. You could add to the rule a Lookup Issues action to look for issue based on a JQL statement that searches for issues where the specified text field has the same contents as the text field of the issue that transitioned. You could then check if results of the Lookup Issues action was more than 1 issue using an Advanced Compare.
You would then need to have the rule take some action when the results have more than 1 issue. The issue could be sending an email to somebody to alert them of the issues with duplicated values.
If it is possible to change the field value during the transition to Closed, this would not prevent the transition.
Q1-As a whole. Case does not make difference.
Q2-Only reason for using the text field is that it can be whatever the creator puts it. Yes, I am using a text value to track.
Q3-the issues can be about few hundreds. I am not sure how to use "Lookup Issues action"
I am not sure how to do this... It seems to make sense though.
"You could create an Automation Rule that is triggered by a change of value on that text field. You could add to the rule a Lookup Issues action to look for issue based on a JQL statement that searches for issues where the specified text field has the same contents as the text field of the issue that transitioned. You could then check if results of the Lookup Issues action was more than 1 issue using an Advanced Compare."
Example:
I have a field called "MFR Code". It has the value "B6".
Before I can close this ticket with the value B6, I would like the rule to check if the value has been used in any other tickets in the issue type "Manufacturing Code Request" because I do not want to create a new ticket with the value that had been used for another MFR.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can find documentation for all the available Actions for Automation Rules here:
https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/
The JQL statement you use in this action would use a smart value for the MFR Code field for the criteria, thus:
type="Manufacturing Code Request" and "MFR Code" ~ {{triggerIssue.MFR Code}} and key != {{triggerIssue.key}}
The last bit is to exclude the triggering issue from the results.
To check the number of results returned you would use an Advanced Compare thus:
One more question - do you expect that users will add that includes spaces or non-alphanumeric characters?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh my my!
This worked.
Used "Related issues condition"
issuetype="Manufacturing Code Request" and "MFR Code" ~ {{triggerIssue.MFR Code}} and key != {{triggerIssue.key}}
Thank you so much.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @James Park
You can have automation help with this, but automation doesn't provide validation. You could take this approach:
Use an automation rule like this:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.