The built in ScriptRunner Script "Clones an issue and links" doesn't clone the attachments of the original Issue.
I'm using the following "Additional issue actions" to dynamically set the "Target Project" according to a predefined custom field:
import com.atlassian.jira.component.ComponentAccessor issue.setProjectObject(ComponentAccessor.getProjectManager().getProjectObjByName(sourceIssue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Linked Project")).getValue())) issue.setSecurityLevelId() issue.setAssigneeId() checkLink = {link -> false} checkAttachment = {attachment -> true}
Setting the Target Project works fine, only Problem is that attachments won't be cloned.
I was able to hunt down the root cause myself:
The project in Question has a changed project key. As documented the attachments will still be stored using the original project key.
This part in your "copyAttachments" function is wrong:
def filePath = PathUtils.joinPaths(pathManager.attachmentPath, issue.projectObject.key, issue.key, attachment.id.toString())
It should be refering to "originalKey" for both project and issue key.
Can this please be fixed?
Thanks for that, I created https://jamieechlin.atlassian.net/browse/GRV-556 - please watch for updates.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have not... but it seems easy enough to solve. I will try to get to it, but no plans for a new release for a few weeks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, it did not. But I've made and tested the changes now and it will go into the next version: https://jamieechlin.atlassian.net/browse/GRV-806. Will release next week.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your fast reply, I did some more testing and was able to gather the following further info:
I get the following Message in my logs when the Problem occurs.
WARN /secure/CommentAssignIssue.jspa [jira.workflow.postfunctions.CloneIssue] Attachment file does not exist where it should. Not copying.
Maybe this is related to more restrictive Permissions in effect for the Service Desk Project?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does it work if you don't change the project?
Have you checked the logs, it looks like the following lines of your code are not valid:
issue.setSecurityLevelId() issue.setAssigneeId()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.