Hii,,
can anybody plz help me with this , i want to read csv file from attachment using script runner .
Here is a simplest version that I can share,
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.util.AttachmentUtilsdef issueManager = ComponentAccessor.getIssueManager()def attachmentManager = ComponentAccessor.getAttachmentManager()def issue = issueManager.getIssueObject("<DESIRED_ISSUE_KEY"); // e.g. SP-1def 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.
Hi @DPKJ
Did you get as far as reading an attachment?
Best
Tom
It worked for me when I last tried.
I will give it another trial once I get some time.
It looks like you're new here. Sign in or register to get started.