It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
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.
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()
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.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
Hi Jamie Have you had a chance to look at this one? I just realised that is why our attachments have stopped copying on a clone action
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It started as any story starts, on a normal, rainy day. Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...
Connect with like-minded Atlassian users at free events near you!
Find a groupConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.
Start an AUGYou're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.