Hi Team,
I have one file in my C drive, when Issue has been created in Project ABC, the file should be attach automatically.
I am using below code but not working as I expected.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueFieldConstants
import com.atlassian.jira.issue.attachment.TemporaryWebAttachment
import com.atlassian.jira.issue.attachment.TemporaryWebAttachmentManager
import webwork.action.ActionContext
def attachmentManager = ComponentAccessor.getAttachmentManager()
def user = ComponentAccessor.getJiraAuthenticationContext()?.getUser()
def bean = new CreateAttachmentParamsBean.Builder()
.file(new File("C:/Applications/Capgemini.jpg"))
.filename("Capgemini.jpg")
.contentType("image/png")
.author(user)
.issue(issue)
.build()
attachmentManager.createAttachment(bean)