Ensure that an issue has at least one attachment

Use case

Validate that an issue has specific files attached.

In this use case, we want to validate that our issue has the following files attached:

  • At least one .jar file

  • At most five .txt files

  • Exactly one .xml file

  • At least three images (any format).


โš’๏ธ Configuration

Add the Logical validator to the desired workflow transition.

Expression

Add the following expression:

matches(%{issue.attachments.details}, "(.*application/java-archive.*){1,}") AND matches(%{issue.attachments.details}, "(.*text/plain.*){0,5}") AND matches(%{issue.attachments.details}, "(.*text/xml.*){1}") AND matches(%{issue.attachments.details}, "(.*image/.*){3,}")

Expression in detail:

Files

Expression

At least 1 .jar file


matches(%{issue.attachments.details}, "(.*application/java-archive.*){1,}")


At most 5 .txt files


matches(%{issue.attachments.details}, "(.*text/plain.*){0,5}")


Exactly 1 XML file


matches(%{issue.attachments.details}, "(.*text/xml.*){1}")


At least 3 images


matches(%{issue.attachments.details}, "(.*image/.*){3,}")




๐Ÿ“ท Screenshots

EnsureThatAnIssueHasAtLeastOneAttachment.png


๐Ÿ“š Related use cases