Hi Team,
Can someone please help me to add an attachment using scripted post function?
I used the suggestion in below link and it looks like the attachment is getting deleted after the script execution, how can I ensure the script does not delete the file from the location.
https://community.atlassian.com/t5/Answers-Developer-Questions/Is-there-a-way-to-add-an-attachment-with-automation-on-Subtask/qaq-p/467766
def attachmentManager = ComponentAccessor.getAttachmentManager()
def pathManager = ComponentAccessor.getAttachmentPathManager()
def user = ComponentAccessor.getJiraAuthenticationContext()?.getLoggedInUser()
def bean = new CreateAttachmentParamsBean.Builder()
.file(new File("/appl/jira_shared/test.txt"))
.filename("text.txt")
.contentType("plain/txt")
.author(user)
.issue(issue)
.build()
attachmentManager.createAttachment(bean)
Regards,
Prashant