I use this construction for adding existing csv file from issue to insight object:
import com.atlassian.jira.issue.AttachmentManager
import com.atlassian.jira.issue.attachment.Attachment
import com.atlassian.jira.util.AttachmentUtils
import customRiadaLibraries.insightmanager.InsightManagerForScriptrunner
InsightManagerForScriptrunner im = new InsightManagerForScriptrunner()
def aM = ComponentAccessor.getAttachmentManager()
def pM = ComponentAccessor.getAttachmentPathManager()
def attachments = aM.getAttachments(issue)
if (attachments != null){
def fileName, filePath
attachments.each {a ->
fileName = a.filename
filePath = AttachmentUtils.getAttachmentFile(a)
}
def domainObjectAttachment = im.addObjectAttachment(objectId, filePath, fileName,"",false)
}
Where objectId is your obkect key. Hope that helps.
Hi Eric
Insight doesn't have a built in function to copy attachments from Jira/JSD to an Insight object.
We do have a REST API call which you can find on our documentation page here to add attachments to objects.
Regards,
/Zihni
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.