Block a transition if the type of the attached files is incorrect

Use case

Evaluate if the type of files in the Attachments field is the one specified.

This use case is valid for both conditions and validators . The only difference is that you can specify an additional error message when using a validator.


โš’๏ธ Configuration

Jira expression*

Bash
issue?.attachments.every(attachment => attachment.mimeType == "image/jpeg")

All of the attachments of the current issue must be in JPEG format.

If you need to evaluate if the type of files are in other format replace image/jpeg with the following expressions:

  • application/pdf for PDF files,

  • image/png for PNG files,

  • video/mp4 for MP4 files and

  • binary/octet-stream for log files.

Variations

Jira expression*

Bash
issue?.attachments.every(attachment => attachment.filename.includes(".docx"))

All of the attachments are DOCX files. The expression for this type of file is different from the previous ones.

Jira expression*

Bash
issue?.attachments.some(attachment => attachment.mimeType == "image/jpeg")

Some of the attachments are JPEG files.

Jira expression*

Bash
issue.attachments.filter(attachment => attachment.filename == issue.customfield_10001 + "_Attached_File.pdf").length != 0

At least one of the attachments follows a naming convention. The name of the file is composed of the option selected in a custom field plus a fixed text and the file type.


๐Ÿ“š Related use cases