Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Section


Column
width30%600px


Panel
borderColor#333f48
bgColor#FFFFFF
titleColor#eeeeee
borderWidth1
titleBGColor#333f48
borderStylesolid
titleOn this page

Table of Contents
maxLevel1



Column




Example: Prevent issue creation if another issue with same field value already exists

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:

  • %{00018} is the field code for Project key
  • %{00014} is the field code for Issue key
  • %{10200} is the field code for custom field Invoice. This field code depends on each particular Jira instance


Once configured, transition “Create Issue” will look like this:


Alternative implementation

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:

  • %{00018} is the field code for Project key
  • %{00014} is the field code for Issue key
  • %{10200} is the field code for custom field Invoice. This field code depends on each particular Jira instance


Once configured, transition “Create Issue” will look like this:



Other examples of that function

Condition and validation based on JQL query

Incoming Links
pageCondition and validation based on JQL query
labelsexample



Boolean condition and validator with math. date-time or text-string terms

Incoming Links
pageBoolean condition and validator with math, . date-time or text-string terms
labelsexample



Related Usage Examples

Content by Label
showSpacefalse
cqllabel = "example" and label = "custom-field"