Comparing Attachments of two different issues

Özerk Dolanbay February 3, 2014

Hi all,

I try to copy attachment(s) of subtask issue to parent in the workflow transition but I should make a comparison because there is at least one duplicated attachment.

Thanks for your help in advance.

2 answers

1 accepted

0 votes
Answer accepted
Özerk Dolanbay February 5, 2014
def parentIssueAttachmentsFilenames = []
for (Attachment attachment : parentIssueAttachments) {
	parentIssueAttachmentsFilenames.add(attachment.getFilename())
}
if (!(attachment.getFilename() in parentIssueAttachmentsFilenames))

0 votes
Özerk Dolanbay February 3, 2014
Issue parentIssueObj = issue.getParentObject()
List<Attachment> parentIssueAttachments = attachmentManager.getAttachments(parentIssueObj)

List<Attachment> attchments = attachmentManager.getAttachments(issue)

if(!(parentIssueAttachments.contains(attachment)))

This code doesn't work.

Suggest an answer

Log in or Sign up to answer