Is it possible to copy attachments that are posted to the subtask ticket up to the parent ticket without erasing any of the attachments on the parent ticket?
Hi Lauren,
I'm afraid you can't do this with basic jira functionality which is available out of the box. You'll need 3rd party addons like Scriptrunner, Power Scripts or Automation for Jira to achieve this.
hi @Ivan Tovbin! I have both Scriptrunner and Automation for Jira. Could you walk me through how to use either one of them to build a subtask off of a subtask if one field on the first subtask has a certain selection? I'm using Jira Server.
Sure thing. When exactly do you want this to trigger?
@Ivan Tovbin When the ticket is moved to Done
I see. It seems a scripted post function is the solution here. Here's the code. Use it for a scripted post function on a transition which is used to move a ticket to 'Done' status:
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.AttachmentManagerimport com.atlassian.jira.issue.Issueimport com.atlassian.jira.issue.attachment.Attachmentimport com.atlassian.jira.user.ApplicationUserApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()Issue parentIssue = issue.getParentObject()AttachmentManager attachmentManager = ComponentAccessor.getAttachmentManager()Collection<Attachment> attachments = issue.getAttachments()attachments.each{ attachmentManager.copyAttachment(it, currentUser, parentIssue.getKey())}
It looks like you're new here. Sign in or register to get started.