We want to prevent issue creation when there is already another issue in the project with the same value in a certain field. That field works as a kind of alternative issue key in the project. You can easily extend this example to much more complex cases, like preventing coincidence of values in more than one field at the same time, or in more than one project, all projects in a category, or in all the projects in Jira.
Let's suppose that we have a Text custom field called Invoice, and we want to avoid this field's value to be repeated among issues of same issue type in same project, i.e., we don't want to have two issues with same issue type, in same project and same value in field Invoice.
We are going to introduce a validator Validation based on JQL query in transition "Create Issue" with the following configuration:
JQL Query: project = "%{00018}" AND issuetype = "%{00014}" AND Invoice = "%{10200}"
Note that:
Once configured, transition “Create Issue” will look like this:
There is an alternative implementation based on validator Boolean condition and validator with math. date-time or text-string terms. The following configuration should be used:
Boolean expression is: count(issuesFromJQL("project = '" + %{00018} + "' AND issuetype = '" + %{00014} + "' AND Invoice = '" + %{10200} + "'")) = 0
Note that:
Once configured, transition “Create Issue” will look like this:
Condition and validation based on JQL query
Boolean condition and validator with math. date-time or text-string terms