Can some please explain how to, using Groovy in ScriptRunner for Jira Cloud, copy an attachment from a parent to child workitems i have created?
I found a response claiming HAPI's Issue would have a addAttachment() but the IDE doesn't recognize it nor is it in documentation.
Also, can attachment be copied without first storing as file somewhere?
(Sidenote: it's disturbing that most scripts found are for Server/DataCenter, not Cloud)
HI @Sten W ,
My name is Bobby I am a Senior Customer Success Manager with ScriptRunner.
Apologies with the confusion with the documentation given in the other answer. The link provided which shows Javascript is our integration tool, ScriptRunner Connect, not ScriptRunner for Jira.
Also, references you have seen to the addAttachment function in HAPI are for DataCenter. While HAPI exists on Datacenter and Cloud, its much younger on Cloud so we are working to develop it to match DC, but its not there yet.
I am not sure if you got the answer from support, but you can copy attachments over with this script:
https://bitbucket.org/Adaptavist/workspace/snippets/rqgoLX
You are correct our example scripts do lean heavily towards DC right now. This is (as with HAPI) something we are looking to improve. I will feed back to the team to see if we can get this script added as an example script, as it is a very useful one.
Does this help?
Kind regards,
Bobby
Hi @Sten W ,
probably you are looking a scriptrunner guide for JIRA Data Center (https://docs.adaptavist.com/sr4js/8.8.1/hapi/work-with-attachments ). Please take a look to the following guide for a Cloud instance https://docs.adaptavist.com/src/latest/scripting/code-snippets/working-with-attachments
Hope this helps,
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, not looking FOR Data Center.
And your second link is about javascript which i can't see how i would somehow inject in Groovy code environment where my Groovy script runs under "ScriptRunner for Jira Cloud".
Perhaps this Atlassian forum only concerns the implementation of ScriptRunner inside Jira, not the use of it?
So while in Grovy i have addedChildIssue (a Issue), how can i add a copy of the attachment from it's parent (what triggered by ScriptRunner listener) to it?
I guess i'll try on adaptavist's support channels. Their pages is full of sales-pitches with little substance with Documentation sections full of "see how easy to do... simple stuff" but little more in-depth details.
I would like to have attachment-processing info on https://docs.adaptavist.com/sr4jc/latest/hapi/work-with-issues
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.