Starting from version 1.9.0, Smart Attachments for Jira supports workflow validators. Validators allow you to verify that any action performed to the transition is valid prior to the issue being moved to the next workflow step. If validation fails, transition to the next workflow step is rejected and the transition's post functions are not performed. 

Available Validator Types

ValidatorDescriptionConfiguration
File Uploader is UserValidates that there is at least one attachment uploaded by one of the selected users.Selection of one or multiple users.

File Uploader is in Group

Validates that there is at least one attachment uploaded by the user from the selected user group.Selection of a user group

File Uploader is in Project Role

Validates that there is at least one attachment uploaded by the user with the selected project role.Selection of a project role

Category is not Empty

Validates that the specified category contains at least one attachment.

Please consider the specifics of the condition while checking one or multiple categories, as follows:

  • For the situations when you need to check presence of at least one attachment in each category, you should create a condition for each category.
  • For the situations when you need to check presence of at least one attachment in any of the categories, you should create one condition and enumerate multiple categories in it.

Manual entry of one or multiple category names for checking.

Optionally, you can define verification of attachment availability, as follows:

  • any file in the category
  • files matching the name pattern
  • files matching the enter regular expression

Note that the app doesn't consider flags of regular expressions

Verify Number of Attachments in CategoryChecks that the specified number of attachments is available in the category.

Manual entry of the category name and the number of attachments that should be available in it.

Optionally, you can define verification of attachment availability, as follows:

  • any file in the category
  • files matching the name pattern
  • files matching the enter regular expression

Note that the app doesn't consider flags of regular expressions

You can also enable the option to treat document revisions as distinct attachments.

All validators allow you to set only one criterion per validator. If you want to validate several criteria at once during the transition, you should create separate validators, one per each criterion. The only exception is the File Uploader is User validator that allows you to select multiple users at once.

Add Validators

  1. Open the project workflow for which you want to add a validator.
  2. Switch the project workflow to the edit mode.
  3. Locate the appropriate transition (arrowed line) and click Validators in the properties panel. Alternatively, you can select the target workflow step (when working with the text version of the workflow). You are redirected to the page listing the validators.
  4. Click Add validator.
  5. On the opened page, select the appropriate validator type.
  6. Click Add.
  7. Configure the workflow validator.
  8. Click Add.
  9. In the notification block, click Publish.

Note that validators are executed one by one and not all at once.

Edit validators

  1. Open the workflow step containing validators you want to modify.
  2. On the Validators tab, locate the validator for editing.
  3. Click Edit  icon.
  4. Make the required modifications.
  5. Click Update.

Delete validators

  1. Open the workflow step containing validators you want to modify.
  2. On the Validators tab, locate the validator for removal.
  3. Click Delete  icon.

Using name patterns and regular expressions

Smart Attachments for Jira allows you to use the name patterns and regular expressions for verifying attachments stored in categories.

Name Patterns

Name patterns allow you to quickly enumerate the full or partial file names or file formats of attachments that should be verified by the validator. You can enter one or multiple words or file formats for verification by the validator. In case of multiple items, you need to separate them with the comma.

For example, you want to verify only attachments containing the word 'contract'. Enter the word 'contract' into the corresponding text field.

If you want to verify the specific file formats (for example, DOC and PDF files), you should enter 'doc, pdf' into the corresponding text field.

Regular Expressions

Regular expressions allow you to quickly enter the flexible query for verifying specific attachments in categories.

For example, you want to verify only attachments with *.docx and *.pdf formats. You need to enter the following regular expression '(.+?)(.docx|.pdf)$'.

Note that the app doesn't consider flags of regular expressions

It means that if you can't use any of the following flags when creating a regular expression for the app:

  • g : matches the pattern multiple times
  • i : makes the regex case insensitive
  • m : enables multi-line mode
  • u : enables support for unicode
  • s : causes the . to also match new line characters

However, you can rewrite RegExp without flags to satisfy your needs.