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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Syncronise Attachments (listner not fired) from Web portal Edited

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
Community showcase
Published in Jira Service Desk

The Complete Guide to Atlassian for ITSM

Hi Atlassian Community! This is Teresa from the Atlassian team. My colleague Paul Buffington @Buff and I are excited to share a brand new ITSM resource we’ve created – "The Complete Guide to At...

2,245 views 14 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you