Here is a simplest version that I can share,
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.util.AttachmentUtils
def issueManager = ComponentAccessor.getIssueManager()
def attachmentManager = ComponentAccessor.getAttachmentManager()
def issue = issueManager.getIssueObject("<DESIRED_ISSUE_KEY"); // e.g. SP-1
def attachments = attachmentManager.getAttachments(issue)
attachments.each{ attachment ->
def fileName = attachment.fileName
def filePath = AttachmentUtils.getAttachmentFile(attachment)
def attachmentFile = new File(filePath)
}
Important portion here are, fetching attachment object and getting it's file path using AttachmentUtils helper class (this is because attachments are stored in file system using special directory structure)
Once you have attachment file you can use it as you wish.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.