Require attachment for specific request types

Ali Azzam April 26, 2024


When internal users create a new bug case and choose a specific request type, I would like to make it mandatory to attach system input files (used to debug)

What do you recommend?

Br. Ali

1 answer

0 votes
Matt Parks
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 26, 2024

If you have Scriptrunner, you can add a custom script validator on the Create transition in your workflow.

Below is the script I use to require an attachment if the "Octopus Update Type" field is set to "Octopus Variable Update" (otherwise it is not necessary to add an attachment)


import com.atlassian.jira.issue.Issue
import com.opensymphony.workflow.InvalidInputException
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.IssueFieldConstants
import com.atlassian.jira.component.ComponentAccessor

def numIssues = ((MutableIssue) issue).getModifiedFields().get(IssueFieldConstants.ATTACHMENT).getNewValue() as Collection<Long>

def octUpdateTypeField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectsByName("Octopus Update Type").first()

def octUpdateValue = issue.getCustomFieldValue(octUpdateTypeField) as String

if (octUpdateValue != "Octopus Variable Update") {
  return true;

if (octUpdateValue == "Octopus Variable Update" && (numIssues.size() == 0 || numIssues == null)) {
  invalidInputException = new InvalidInputException("There must be at least one attachment.")

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events