Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 57 Next »

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

On this page:

Field has been modified validator

This validator can be used to block the user from progressing to a destination status unless a field has been modified.

Sample use cases:

  • (lightbulb) Validate the change in Resolution provided when closing an issue

     Steps
    • Add the Field has been modified validator to the Close transition.
    • Select Resolution from Field.

Field is required validator

This validator can be used to ensure that a field has a value during a transition.

Sample use cases:

  • (lightbulb) Validate the Affects Version/s and Assignee fields for a non-empty value on creating a Bug.

     Steps
    • Add the Field is required validator to the Create transition.
    • Select Affects Version/s and Assignee from Fields.

Comment required validator

This validator can be used to force the users to enter a comment while transitioning to a destination status.

Sample use cases:

  • (lightbulb) Validate that a comment is entered when rejecting a Bug fix.

     Steps

    Add the Comment required validator to the Reject transition of the Bug workflow.

Field has single value validator

This validator can be used to check that a multi-valued field does not have more than one value during a transition.

Sample use cases:

  • Lightbulb on (on) Validate the Fix Version/s  for a single value on an issue when the issue is fixed.

     Steps
    • Add the Field has single value validator to the Close transition.
    • Select Fix Version/s from Field.

Previous status validator

This validator can be used to stop the user from transitioning to a status unless the issue has previously been in a specified status in the workflow.

Sample use cases:

  • (lightbulb) Block the transition of an issue to Close status if it has not been Approved.

     Steps
    • Add the Previous status validator to the Close transition.
    • Select Approved from Previous Status

Parent status validator

This validator can be used to stop the user from transitioning to a status unless the issue's parent has been in a selected status in the workflow.

Sample use cases:

  • (lightbulb) Block the trigger of "Start Progress" on subtasks until its parent is approved.

     Steps
    • Add the Parent status validator to the Start Progress transition.
    • Select Approved from Parent Status

Scripted (Groovy) validator

This validator can be used to perform a validation with a groovy 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) Block the creation of a Bug if no Attachment is provided.

     Steps
    • Add the Scripted (Groovy) validator to the Create transition.
    • Write the following in the Groovy script

      try {
        return issue.get("issuetype").name != "Bug" && issue.getModifiedFields()?.get("attachment")?.getNewValue()?.size() > 0
      } catch (Exception e) {
        return false
      }
  • (lightbulb) Validate the Cascade select for values in parent and child select dropdowns

     Steps
    • Add the Scripted (Groovy) validator to the transition.
    • Write the following in the Groovy script

       issue.get("Cascade")?.get(null) != null && issue.get("Cascade")?.get("1") != null
  • (lightbulb) Block the approving of the Change request if it has no confluence page linked

     Steps
    • Add the Scripted (Groovy) validator to the Approve transition.
    • Write this content in the Groovy script.

      issue.getRemoteLinks("confluence").size() > 0
    • Type the error message in Error message, to display if the validation script returns false
  • (lightbulb) Block the approval of an issue if there is no PDF attached either from before or added during the transition

     Steps
    • Add the Scripted (Groovy) validator to the Approve transition.
    • Write this content in the Groovy script.

      import com.atlassian.jira.issue.IssueFieldConstants
      import com.atlassian.jira.issue.attachment.Attachment
      import com.atlassian.jira.issue.attachment.TemporaryWebAttachment
      import com.atlassian.jira.issue.attachment.TemporaryWebAttachmentManager
      
      if (issue.get("attachment").any{it.filename.endsWith(".pdf")}) 
        return true;
      
      TemporaryWebAttachmentManager attachmentManager = getComponent(TemporaryWebAttachmentManager)
      try {
          List<Long> ids = issue.getModifiedFields().get(IssueFieldConstants.ATTACHMENT).getNewValue();
          if (ids)
              return ids.any { id ->
                  def attachment = attachmentManager.getTemporaryWebAttachment(id).getOrNull()
                  return attachment?.filename?.endsWith(".pdf")
              }
      } catch (Exception e) {
      }
      return false
    • Type the error message in Error message, to display if the validation script returns false

Related Issues Status validator

This validator ensures that the current issue's related issues (such as linked issues, Stories of an Epic, Epic of a Story, subtasks of an issue, issues returned by a Groovy script or a JQL search, etc.) are in one of the specified statuses.

Sample use cases:

  • (lightbulb) Block the transition of the Epic to Closed status, if its stories aren't closed.

     Steps
    • Add the Related issues status validator to the Close transition.
    • Select the issue link type Epic of the current issue from Which Issue(s) field.
    • Select the statuses the linked issues must be in, from Statuses

    • Add the error message, "The Stories of the Epic are not yet resolved"

Related Issue(s) validator

This validator ensures that a link to one (or more) issue(s) from the current issue is being created during the transition, and/or that existing and/or newly related issues (such as linked issues, Stories of an Epic, Epic of a Story, subtasks of an issue, issues returned by a Groovy script or a JQL search, etc.) have certain characteristics.

Sample use cases:

  • (lightbulb) Block the creation of a Bug, if it is not linked to the corresponding functionality requirement.

     Steps
    • Add the Related issue validator to the Create transition.
    • Select the Issues linked to the current issue through the following link type from the Issue Link Type field.
    • Select the issue link type relates to from the Issue Link Type field.

    • Add the error message, "Associate/Link the Bug to the respective requirement ticket"


  • No labels