Check whether an attachment was added during the transition.

Use case

To ensure that files are actually uploaded during a transition (e.g., on the transition screen), this setup validates whether any new attachments were added.


โš’๏ธ Configuration

Jira expression*

Bash
issue.attachments.filter(attachment => attachment.id == null).length > 0

This expression checks for attachments that are present but donโ€™t yet have an ID, which indicates they were uploaded during the transition.

Attachments added during the transition are already included in issue.attachments, but they do not yet have an id at the time the validator is evaluated.

The absence of an id is used to detect newly added files and block the transition if none are present.

You can refine the validation by filtering for specific file types or filenames.

For example, to allow only PDF uploads during the transition, use:

Bash
issue.attachments.filter(a => a.id == null && a.mimeType == "application/pdf").length > 0

You can also check for specific filenames:

Bash
issue.attachments.filter(a => a.id == null && a.filename.toLowerCase().includes("invoice")).length > 0

Combine multiple conditions as needed to tailor the validation to your requirements.


๐Ÿ“š Related use cases