Availability
This routine is available starting with katl-commons 4.0.3.
This routine is available for Jira server and cloud deployment options.
Syntax
copyAttachment(issueKey1, attachmentName, issueKey2)
Description
Copies an attachment from one issue to another.
Parameters
Parameter name | Type | Required | Description |
---|---|---|---|
issueKey1 | string | Yes | Issue key. |
attachmentName | string | Yes | Attachment name. |
issueKey2 | string | Yes | Issue key where you want to copy the attachment. |
Return type
boolean (true/false)
Returns "true" if the attachment was copied successfully and "false" otherwise. If returned "false" check the log for a detailed reason on why it failed.
Example
Example 1
copyAttachment("TEST-1", "attachmentToCopy.txt", "TEST-2");
If you have multiple attachments on an issue with the same file name, all of them will be copied.
Example 2
Copy all the attachments from one issue to another.
string issueKey = "TEST-1"; for(string s in issueKey.attachments) { copyAttachment(issueKey, s, "TEST-2"); }
See also