Scripted (Groovy) operation on issue (JMWE add-on) Function for attachments

Matt Marchand February 27, 2019

I am trying to create a groovy script that will attach different files based on a customer field selection.  When testing the script, I am getting the following error.  I am looking for direction on how to resolve.  

 

There was an error during the execution of your script

Message:
com.atlassian.jira.web.util.AttachmentException: Got error while saving attachment Template Test Log Platform Performance.xls: Got exception while saving attachment in attachment store. Exception: https:\confluence.altec.com\display\CON\Design+Assurance+Test+Report+TemplatesTemplate Test Log Platform Performance.xls (The filename, directory name, or volume label syntax is incorrect)

 

 Code:

def bean = new CreateAttachmentParamsBean.Builder()
.file(new File("https://confluence.altec.com/display/CON/Design+Assurance+Test+Report+Templates"+filename))
.filename(filename)
.contentType("text")
.author(currentUser)
.issue(issue)
.build()
ComponentAccessor.attachmentManager.createAttachment(bean)

1 answer

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 1, 2019

Hi Matt,

i don’t believe you can pass a URL as the file. The file needs to come from an accessible file system. 

You need to first download the file to a temporary location, and then attach that temporary file. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events