Versions Compared

Key

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

This section has use cases that help you in understanding the usage of Validators provided by JMWE.

On this page:

Table of Contents

Build-your-own (scripted) Validator

This validator can be used to perform a validation with a Jira expression. Based on the result of the expression, the user is either allowed or blocked to transition to the destination status.

Sample use cases:

(lightbulb) Force users to provide Fix Version/s only when the resolution is Fixed

Expand
titleClick here for the steps to configure
  • Add the Build-your-own (scripted) validator to the Resolve transition.

  • Write the following script in Jira expression field

    Code Block
    issue.resolution.name != "Fixed" || issue.fixVersions && issue.fixVersions.length > 0

(lightbulb) Prevent the user from approving a hardware request if the respective hardware (count stored in a custom field) is out of stock

Expand
titleClick here for the steps to configure
  • Add the Build-your-own (scripted) validator to the Create transition.

    • Write the following script in Jira expression field

    • Code Block
      !!issue.customfield_10202 && issue.customfield_10202 > 0
    • Configure the error message: Inventory out of stock, where xxxxx is the id of the custom field holding the count of the stock

(lightbulb) Prevent the employee from applying for a leave if the employee is in the 3 month probation period

Expand
titleClick here for the steps to configure
  • Add the Build-your-own (scripted) validator to the Apply leave transition.

    • Write the following script in Jira expression field

      Code Block
      !! issue.dueDate && issue.dueDate.plusMonths(3) > new Date().toCalendarDate()
    • Configure the error message: Cannot apply for a leave

Field required Validator

This validator can be used to conditionally perform a validation to ensure that the specified field has a value during a transition.

Sample use cases:

(lightbulb) Force users to provide Fix Version/s when resolving the issue

Expand
titleClick here for the steps to configure
  • Add the Field required validator to the Resolve transition.

  • Select the Fix Version/s field

(lightbulb) Prevent the user from progressing on the Bug it is not assigned

Expand
titleClick here for the steps to configure
  • Add the Field required validator to the Start Progress transition.

  • Select the Assignee field

  • Select the Conditional validation option

  • Input the following script in Validator scope section

    Code Block
    issue.issueType.name == "Bug"
  • Configure the error message: Assign the issue

Linked Issue(s) validator

...

Expand
titleClick here for the steps to configure
  • Add the Linked issues status validator to the Create transition.

  • Select the issue link type is subtask of from the Issue Link Type field.

  • Select the statuses "Resolved", "Closed",  "Rejected", from Statuses

  • Add the error message, "The parent should be in Resolved or Closed or Rejected" status.

Build-your-own (scripted) Validator

This validator can be used to perform a validation with a Jira expression. Based on the result of the expression, the user is either allowed or blocked to transition to the destination status.

Sample use cases:

(lightbulb) Force users to provide Fix Version/s only when the resolution is Fixed

Expand
titleClick here for the steps to configure
  • Add the Build-your-own (scripted) validator to the Resolve transition.

  • Write the following script in Jira expression field

    Code Block
    issue.resolution.name != "Fixed" || issue.fixVersions && issue.fixVersions.length > 0

(lightbulb) Prevent the user from approving a hardware request if the respective hardware (count stored in a custom field) is out of stock

Expand
titleClick here for the steps to configure
  • Add the Build-your-own (scripted) validator to the Create transition.

    • Write the following script in Jira expression field

    • Code Block
      !!issue.customfield_10202 && issue.customfield_10202 > 0
    • Configure the error message: Inventory out of stock, where xxxxx is the id of the custom field holding the count of the stock

(lightbulb) Prevent the employee from applying for a leave if the employee is in the 3 month probation period

Expand
titleClick here for the steps to configure
  • Add the Build-your-own (scripted) validator to the Apply leave transition.

  • Write the following script in Jira expression field

    Code Block
    !! issue.dueDate && issue.dueDate.plusMonths(3) > new Date().toCalendarDate()
  • Configure the error message: Cannot apply for a leave