I used Jira API to write a function to copy attachments to another issue like below:
public void copyAttachmentsToAnotherIssueWithKey(
final String targetIssueKey,
final List<Long> attachmentIds
ApplicationUser currentUser = jiraAuthenticationContext.getLoggedInUser();
List<Attachment> attachments = attachmentIds.stream().map(attachmentManager::getAttachment).collect(Collectors.toList());
attachments.forEach(attachment -> attachmentManager.copyAttachment(attachment, currentUser, targetIssueKey));
It copied successfully, but in the 'History' of the target issue, there is no update.
Furthermore, when I used JQL search with 'attachments is not EMPTY', the target issue was not in the results although the attachments already exist in the target issue.
Could you provide me with a solution? Thanks.
Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events