Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptRunner add attachment in jira SM cloud?

Sten W April 1, 2025

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)

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 1, 2025

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 

Sten W April 1, 2025 edited

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

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events