在创建issue时要对附件进行限制可以使用以下代码
8.1.0 版本及以上
import com.opensymphony.workflow.InvalidInputException if(issue.attachmentsAddedInTransition.size() == 0) { throw new InvalidInputException("attachment", "Attachment is required") }
8.0.0 版本及以下
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.attachment.TemporaryWebAttachmentManager import com.atlassian.jira.issue.fields.AttachmentSystemField import webwork.action.ActionContext def temporaryAttachmentManager = ComponentAccessor.getComponent(TemporaryWebAttachmentManager) def temporaryAttachmentIds = ActionContext.getRequest()?.getParameterValues(AttachmentSystemField.FILETOCONVERT) temporaryAttachmentIds.each { String attachmentId -> def attachment = temporaryAttachmentManager.getTemporaryWebAttachment(attachmentId).getOrNull() if (attachment) { log.debug "Uploaded attachment name: ${attachment.filename}" } }