Hi everyone,
I'm trying to figure out how to use the Custom script scriptrunner post-function to look for attachements within the create screen, and after the issue is created, add the Jira ticket ID to the front of the attachement(s) name(s).
So far I have this:
import org.ofbiz.core.entity.GenericValue
import com.atlassian.jira.ofbiz.OfBizDelegator
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.attachment.Attachment
def attachmentManager = ComponentAccessor.getAttachmentManager()
OfBizDelegator delegator = ComponentAccessor.getComponentOfType(OfBizDelegator.class)
issue.get("attachment")?.each {
for(GenericValue attachment : delegator.findByField("FileAttachment", "id", it.id)){
attachment.setString("filename", issue.summary+it.filename)
attachment.store()
}
}
but I can't seem to get this to work. Can anyone help with this?
Thanks,
Mike