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.")
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.