Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Copy attachments from one issue to another linked issue in another project


Is there some kind of post function or listener that enables copying of attachments form one issue to his linked issue in another project? I would like to do it with ScriptRunner for cloud.

2 answers

1 accepted

3 votes
Answer accepted
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 01, 2021

OOTB I don’t believe there is a solution for this. I would suggest Automation but there is an open request for this - AUT-1030 . There are addon solutions, e.g. Exlate and probably scriptrunner.

I have scriptrunner and that is the way I would like to implement solution. Do you know how to implement it?




Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 01, 2021 • edited

A search in the Community search bar returns this - 

if you find the right solution for you please add to the post for future searches.

Laura Campbell _Elements_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 01, 2021

Hi @Filip Škledar ,

If you're open to trying another app, Elements Copy & Sync allows you to copy attachments between linked issues.

For example, if you use the app to clone a JSM ticket into a software project (or just create a linked ticket), you can have attachments from the JSM ticket copied over to the new issue. This works even with new attachments, like when a customer provides something new on the JSM ticket.

If you have any trouble setting it up, don't hesitate to contact the Elements support team.


Like # people like this

If still needed, I can share code for this :) 

Lukasz Grobelny, Yes, Please share your code for this. Thank you so much.

Like Ziyarat Mahmudzadeh likes this

@Lukasz Grobelny , can you please share the code.

Cloud or server?

So I added a custom field (select list) where the user was able to select if he want to copy the attachment as well, if he selected attachments the script would go like this:

for(int i = 0; i < attachment.size(); i++ ){
def attId =[i]
def att = Unirest.get('/rest/api/2/attachment/' + attId).asObject(Map).body
def downloadUrl = attachment.content[i]
def readFileResp = Unirest.get(downloadUrl).asBinary()
def response ='/rest/api/2/issue/' + createdIssueKey + '/attachments')
.header("Accept", "application/json")
.header("X-Atlassian-Token", "nocheck")
.field("file", readFileResp.body, att.title.toString())


Hi Lukasz could you share a code you have for server Jira version? Thank you in advans

Hi, sorry, missed this... do you still need it?

Yes, please.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.context.IssueContext
import com.atlassian.jira.issue.context.IssueContextImpl
import com.atlassian.jira.issue.fields.config.manager.PrioritySchemeManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.AttachmentManager
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
import org.apache.log4j.Logger
import com.atlassian.jira.component.ComponentAccessor

/Puling the CF
def summary = issue.getSummary()
def assignee = issue.getAssignee().getDisplayName()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def commentManager = ComponentAccessor.getCommentManager()
def existngComments = commentManager.getComments(issue);
def originalIssueType = issue.getIssueType().getName()
def originalDescription = issue.getDescription()
def priority = issue.getPriority().getName()

//Project picker - we need to select a destination project
def cField = customFieldManager.getCustomFieldObject("customfield_10201")
def projectKeyValue = (String) issue.getCustomFieldValue(cField)
//Cleaning the value
def projectKeyFromPicker = projectKeyValue.minus("Project: ")

//Selector of what will be moved - Checklist field on which users can elect what they want to mowe - comments etc
def additionalFieldsSelector = customFieldManager.getCustomFieldObject("customfield_10300")
def additionalFields = issue.getCustomFieldValue(additionalFieldsSelector) as String

// Reporter
final reporterKey = issue.getReporter().getKey()

final priorityName = 'Major'

def subTasks = issue.getSubTaskObjects()
def issueService = ComponentAccessor.issueService
def constantsManager = ComponentAccessor.constantsManager
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def prioritySchemeManager = ComponentAccessor.getComponent(PrioritySchemeManager)
def project = ComponentAccessor.projectManager.getProjectObjByKey(projectKeyFromPicker)
def issueType = constantsManager.allIssueTypeObjects.findByName(originalIssueType)

//Logged in user will be used
def reporter = ComponentAccessor.userManager.getUserByKey(reporterKey) ?: loggedInUser
def assignableUser = ComponentAccessor.userManager.getUserByName(assignee) ?: loggedInUser

// Setting up the priority
def issueContext = new IssueContextImpl(project, issueType) as IssueContext
def priorityId = constantsManager.priorities.findByName(priority)?.id ?: prioritySchemeManager.getDefaultOption(issueContext)

//creating the issue
def issueInputParameters = issueService.newIssueInputParameters().with {

def validationResult = issueService.validateCreate(loggedInUser, issueInputParameters)
assert validationResult.valid : validationResult.errorCollection

def result = issueService.create(loggedInUser, validationResult)
assert result.valid : result.errorCollection
def newIssue = result.getIssue()

log.warn("${result.getIssue()} + was created" )

//Atthachment copy
def issueObject = issue.getAttachments()
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
AttachmentManager attachmentManager = ComponentAccessor.getAttachmentManager();
attachmentManager.copyAttachments(issue, currentUser,result.getIssue().key)

//Comment Copy
for(int i = 0; i < existngComments.size(); i++){
def commentAuthor = existngComments.getAt(i)getAuthorApplicationUser()
def newBody = existngComments.getAt(i).getBody()
//Issue link

// Link type
final String issueLinkName = "Duplicate"

final Long sequence = 1L

def issueLinkTypeManager = ComponentAccessor.getComponent(IssueLinkTypeManager)

def availableIssueLinkTypes = issueLinkTypeManager.issueLinkTypes
def linkType = availableIssueLinkTypes.findByName(issueLinkName)

ComponentAccessor.issueLinkManager.createIssueLink(,,, sequence, loggedInUser)
Like Ingo Jurz likes this

The way it works - the user selects Copy on the issue.

On a Copy screen, he can select the Destination project; on the checklist, he can choose what will be moved.


You can trim it down just to copy the issue without fireworks

Suggest an answer

Log in or Sign up to answer