Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Syncronise Attachments (listner not fired) from Web portal

Normann P_ Nielsen _Netic_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 26, 2019

I have a "sync attachement listener" - listening on "Issue updated" and I works fine from the JIRA Interface.

The code is partly:
-------
List changeItems = event.getChangeLog()?.getRelated("ChildChangeItem")
changeItems.each {GenericValue gv ->
if (gv["field"] == "Attachment" && gv["newvalue"]) {

attachmentIds.add(gv["newvalue"])
Integer AttachmentId=Long.parseLong(gv["newvalue"])
Attachment AttachmentObject=attachmentManager.getAttachment(AttachmentId)
// If the comment is by AgentRobot, do not send it back (loop)
if (AttachmentObject.getAuthorObject() != userManager.getUserByKey("AgentRobot"))

{ attachmentManager.copyAttachment(AttachmentObject,userManager.getUserByKey("AgentRobot"),targetIssue.key) log.info "Script=" + scriptName + " IssueKey=" + issueKey + " ScriptRunIdent=" + scriptRunIdent + " Message='Attachment " + AttachmentObject.getFilename() + " copied to " + targetIssue.key + "'" }

}
}


On the Web Portal - Issue Updated is never fired for attachments, only "Issue Commented" - and the changeItems does not represent the attachment.

How can I get the attachment handle/info?

 

Its 7.13.1 and JSD 3.16.0

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events