Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Want to copy all the attachments and comments from parent task to subtask

kiranmai_genkolla March 17, 2022

Want to copy all the attachments and comments from parent task to subtask

2 answers

1 accepted

1 vote
Answer accepted
Florian PEREZ [Valiantys Administrator]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 18, 2022

Hello and welcome in the community.  

To do this you'll need to get a plugin. They're plenty of plugin to do this (I would suggest Automation or Scriptrunner but others tools can do the trick too)

When you'll get the plugin you looking for you got two solution, with automation, you build an automatisation to copy this to the child issue ( not hard to do ) OR with other plugins set the copy into the workflow in a postfunction. 

 

Hope this help . 

Florian 

kiranmai_genkolla March 24, 2022

i have script runner can you help me in code to copying the attachments to subtasks 

and where to be written as well

Florian PEREZ [Valiantys Administrator]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 24, 2022
Like kiranmai_genkolla likes this
kiranmai_genkolla April 6, 2022

Hi Florian,

 

the script is working perfectly thanks :)

One more sscript is running to copy all the attachments from subtasks to Parent .So i need to make unique while attaching the script from subtask to parent .

code from subtask to parent :

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.AttachmentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.attachment.Attachment
import com.atlassian.jira.user.ApplicationUser

ApplicationUser 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())
}



If the attachment is already there , then that should not copy .

Can you help in how to achieve this 

0 votes
Seda Taş December 27, 2022

Hi @kiranmai_genkolla and @Florian PEREZ [Valiantys Administrator]

 

Thanks a lot for the shares. I am very new to groovy script and need help with something.

How can I use a script to copy the data from the attachment attached to an issue to a custom field on the task?

 

Thanks for help . 

Suggest an answer

Log in or Sign up to answer